Page 1 of 1

Get Parameter

Posted: Thu Apr 29, 2010 2:16 pm
by WingMaker
Hi All,

I need some help please, if someone is sending me an xml when they call my php file, how do I grab that xml file in my php code?

I need to get that file and parse it.

Any Ideas?

thanks
WING

Re: Get Parameter

Posted: Thu Apr 29, 2010 5:56 pm
by requinix
Depends how they're sending it.

You probably want

Code: Select all

file_get_contents("php://stdin")

Re: Get Parameter

Posted: Fri Apr 30, 2010 11:40 am
by WingMaker
This is how my partner would be sending it.

"I would make an HTTP POST request to an URL like http://server.com/shippinglabel.php. Thus I assume that an apache runs on a host and that it has an PHP module installed and that there exists a file shippinglabel.php that extracts the XML file from the HTTP request body and processes it. All information would be in the posted XML file, so there are no more URL parameters. We will use the following request header:

Content-Type: text/xml.
Accept: text/xml

Note that we will NOT use

Expect: 100-continue

Thus, the XML file will be sent with the request headers, not in a second transaction only after the apache server answered with a 100-continue HTTP status code.
We do this since we don't talk to an anonymous server over the Internet but expect the server to process the text/xml in any case."

let me know if you need more information

Thanks
WING

Re: Get Parameter

Posted: Fri Apr 30, 2010 12:12 pm
by requinix
Then yes, the code I posted.