Posting Raw XML to PHP?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I want to post a XML file to a PHP program. I have seen programs using
the following curl format to send the XML:

curl =H"POST / HTTP/1.0 Content-Type:
application/x-www-form-urlencoded Content-Length: 12 " -d"<top></top>"

However, I am not sure what to code on the PHP end to accept the XML.
I checked $_POST and it is empty.  I know you can send the data by
posting to a var, like ( -d"xml=\"<top></top>\"").


Re: Posting Raw XML to PHP?

David wrote:
Quoted text here. Click to load it

Try checking $HTTP_RAW_POST_DATA.

Alternatively, you could use file_get_contents("php://stdin") if your  
PHP install supports it.

I would also specify the correct content-type for my POST message  
("text/xml"), but I've never done it so maybe there's some reason why  
you're not doing that.


Site Timeline