Possible Duplicate:
Framework for providing API access to website?
I need to write a service in PHP. The server will be used by android/iphone clients through the url for example like this
http://www.myservice.com/query.php?param1=a¶m2=2...
I want to use the data format that is easily understood by my android client. In other words, I do not want to reinvent the wheel and create my own format and parsing, instead I would prefer to use any library if it exists. Is there a framework that I can use to abstract the communication mechanism for data get and push ?
Thanks, Ahmed
well, Use mvc framework(yii, ci, ...) and from controller directly print json_encode($object)
.
It will return json data to browser, and consume it anywhere(compuer, droid, iphone, ... , iron :D). the solution is json. just share object in json format, so anyone can map it into it's preferred obejct
here is something something you may have a look
I developed a class that is the PHP native SoapServer class' REST equivalent.
You just include the RestServer.php file and then use it as follows.
class Hello
{
public static function sayHello($name)
{
return "Hello, " . $name;
}
}
$rest = new RestServer(Hello);
$rest->handle();
Then you can make calls from Java like this:
http://myserver.com/path/to/api?method=sayHello&name=World
(Note that it doesn't matter what order the params are provided in the query string. Also, the param key names as well as the method name are case-insensitive.)
Being the Author of Restler, I would like to suggest that you can try Restler 3 for the following reasons