Quickest way to run a REST API - using any opensource tool
Hi I am just creating a quick rest api to call for a iphone application.
What is the开发者_如何学C fastest way to implement on using
- PHP
- MySQL (Data comes from database - simple user table)
You could use Zend_Rest_Server to wrap a simple data access object (which could use Zend_Db
).
From Zend's Docs:
$server = new Zend_Rest_Server();
$server->setClass('My_Service_Class');
$server->handle();
Sample request:
?method=sayHello&who=Davey&when=Day
Assuming:
class My_Service_Class
{
/**
* Say Hello
*
* @param string $who
* @param string $when
* @return string
*/
function sayHello($who, $when)
{
return "Hello $who, Good $when";
}
}
Try NuSOAP, its very simple to implement.
精彩评论