[nycphp-talk] RESTful PHP Frameworks/Libs
csnyder
chsnyder at gmail.com
Wed Nov 28 17:23:07 EST 2007
On Nov 28, 2007 4:54 PM, Rob Marscher <rmarscher at beaffinitive.com> wrote:
> The webserver handles implementing most of what's required for a RESTful
> interface. So... you don't exactly need a framework. Just do the
> appropriate thing on GET/POST/PUT/DELETE requests (which you can determine
> from php's $_SERVER array).
Heh, Apache+PHP _is_ a REST framework.
Okay, I've gotten in enough trouble today. But seriously, you may not
need a library unless you're doing something fancy.
Getting the data out of PUT requests is a bit tricky... here's some code:
switch ($_SERVER['REQUEST_METHOD']) {
case 'PUT':
/* PUT data comes in on the stdin stream */
$putdata = file_get_contents("php://input");
That worked in php 5.1 on unix, not sure about other versions or platforms.
--
Chris Snyder
http://chxo.com/
More information about the talk
mailing list