December 2010
Intermediate to advanced
363 pages
12h 21m
English
What follows is a very basic REST server that you can use to create basic services. It is meant as a starter for you to use, something you can build other functionality on top of (for example, any security measures). First, let's take a look at the two classes we want to use for our implementation, and then we'll walk through it.
class RestUtilities
{
public static function processRequest()
{
$req_method = strtolower($_SERVER['request_method']);
$obj = new RestRequest();
$data = array();
switch ($req_method)
{
case 'get':
$data = $_GET;
break;
case 'post':
$data = $_POST;
break;Read now
Unlock full access