AMFPHP Support for JSON POST
24 July 2009I found myself wanting to use JSON POSTs (not just GETs) with AMFPHP. Here’s the addition.
Open up core\json\app\Gateway.php.
After
$rawArgs = explode('/', $args);
add the following
if(isset($_POST) && count($_POST) > 0)
{
$len = count($rawArgs);
// Check for and remove [last] empty arg from URL '/' explosion
if($len && trim($rawArgs[$len-1]) == "")
unset($rawArgs[$len-1]);
// Append the POST variables
for($i=0;$i
}
The format of the post variables would be argNo=value
Ex.
Backend Function
public function ResetPassword($username,$password,$oldpassword)
{
// Code HERE
}
Javascript POST parameters for the latter
request.send("0=" + escape(username) + "&1=" + escape(oldpassword) + "&2=" + escape(newpassword));
Hoping to jump into ZendAMF soon
