Enables amfPHP to receive and reply with JSON This plugin can be deactivated if the project doesn’t need to support JSON strings and returned as JSON strings using POST parameters.

You must add the ‘application/json’ content type, or set it in the headers so that it is recognized as a call to be handled by this plugin. for example: http://yourserver.com/Amfphp/?contentType=application/json

Here is some sample code using Javascript with JQuery:

var callDataObj = {"serviceName":"PizzaService", "methodName":"getPizza","parameters":[]};
var callData = JSON.stringify(callDataObj);
$.post("http://yourserver.com/Amfphp/?contentType=application/json", callData, onSuccess);

Requires at least PHP 5.2.

see http://community.silexlabs.org/amfphp/reference/classes/AmfphpJson.html for the generated plugin doc.

Laissez un commentaire

News letter

Evénements Silex Labs sur Paris et sa région: Inscrivez vous à la Newsletter mensuelle

Silex Labs community Tweets

Facebook page