receiving XML stream as server via PHP
| From: | Kristopher Yates | Date: | Tue, 31 Dec 2002 21:20:01 +0000 |
| Subject: | receiving XML stream as server via PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-129801@lists.php.net to get a copy of this message | ||
Hi,
Using PHP with cURL, I am currently able to dynamically create XML documents and HTTP POST to a remote server, receive an XML response, and parse XML as needed.
What I am having trouble finding information on is doing the reverse. Basically, I am trying to create a PHP script that acts as a server, so that a remote computer can HTTP POST XML to said script and then I parse and respond in XML. Again, I already have the reverse working using CURL - so basically I have created a client and now I need to create the server.
The only part I need help understanding is how do I get the XML into an array/variable when my script is hit with someone using HTTP POST to pass XML to it. I have an idea below (vague)..
I had the server guy HTTP POST some XML to a script which just had
<? phpinfo(); ?>
I see in the HTTP Request Headers of the phpinfo() output that it received content type text/xml but nowhere do I see what was actually received (the actual xml that was sent). I thought maybe PHP would take the stuff after the header and push it into an array/variable but no such luck (argv?).
I am wondering if anyone has any helpful information. I imagine something like the following psuedo code:
if($HTTP_CONTENT_TYPE=="text/xml"){
//use some php function(s) to pass incoming xml stream to an array that I can then pass to my
//xml parser
}
I hope this gives you enough information to figure out my dilema. If someone can shed a little light on this subject it would be GREATLY appreciated.
Thanks,
Kris
kris@2binteractive.com