Skip to content

Instantly share code, notes, and snippets.

@larscwallin
Created August 29, 2011 19:04
Show Gist options
  • Save larscwallin/1179133 to your computer and use it in GitHub Desktop.
Save larscwallin/1179133 to your computer and use it in GitHub Desktop.
rest without rewrite
<?php
$method = $_SERVER
['REQUEST_METHOD'];
$request = explode("/ ",
substr(@$_SERVER
['PATH_INFO'], 1));
switch ($method) {
case 'PUT':
rest_put($request );
break;
case 'POST':
rest_post($ request);
break;
case 'GET':
rest_get($request );
break;
case 'HEAD':
rest_head($ request);
break;
case 'DELETE':
rest_delete
($request);
break;
case 'OPTIONS':
rest_options
($request);
break;
default:
rest_error( $request);
break;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment