For REST, how do I receive posted data using PHP?

Posted by netrox on Stack Overflow See other posts from Stack Overflow or by netrox
Published on 2012-09-12T15:36:45Z Indexed on 2012/09/12 15:37 UTC
Read the original article Hit count: 277

Filed under:
|

I want to set up a tiny RESTful interface for my web services using PHP. The problem is that I looked at frameworks and I cannot figure out how do I recieve the posted data without field names?

For example, if a server posts data to my server, I cannot figure out how do I get it without needing the postfield (POST variables). Traditionally, with forms, people send post data with field names such as this:

 curl_setopt($ch, CURLOPT_POSTFIELDS, postfield=postvalue);

and I would use PHP code like this:

 $postvalue=$_POST[postfield];

to get value of postfield but since the server posting data is not using postfield and is just sending XML, how do I get it without fields? How do I capture the XML? That's where I am lost.

© Stack Overflow or respective owner

Related posts about php

Related posts about rest