Re: [PHP] receiving XML stream as server via PHP
Hi, I thought there was only one XML standard (1.0)? I guess my question should have been, when someone commits an HTTP POST sending me raw xml data to my PHP script, I imagine PHP would store it in some global variable. What variable is that? Thanks, Kris Jimmy Brake wrote: depends on which xml standard you are using the xml-rpc is what I have been using to ACCEPT xml -- but it does have a server to accept xml http://pear.php.net/package-search.php?pkg_name=xmlbool=ANDsubmit=Search On Tue, 2002-12-31 at 13:20, Kristopher Yates wrote: 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 [EMAIL PROTECTED] . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] receiving XML stream as server via PHP
AH! That is my ticket! Thanks. Yes, my client was posting to my wanna be server script with mime type text/xml. I should be able to easilly take $HTTP_RAW_POST_DATA and pass it straight on to my XML parser. I imagine, when someone posts xml, $HTTP_RAW_POST_DATA will appear as an array. Just what I need. Thanks, Kris Timothy Hitchens (HiTCHO) wrote: You can post to your server with a mimetype of text/xml and in your script pickup the raw post as: $HTTP_RAW_POST_DATA Then just process this string as XML and return to buffer or not. Have fun. Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] HiTCHO | Open Platform Web Development Consutling - Outsourcing - Training - Support - Original Message - From: Kristopher Yates [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 01, 2003 7:20 AM Subject: [PHP] receiving XML stream as server via PHP 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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] receiving XML stream as server via PHP
Hi Chris, Long time no talk to! Hope you had a good new year. Thanks for the info. My development is basically similar to SOAP and XML-RPC like that used for RSS. I'll probably get more into it [SOAP] when they [PEAR gurus] get past the beta testing stage. I am happy with what I have to work with as is for now (PHP with cURL for client side scripts and reuse all that code to create server side scripts) but definitely interested in the alternatives. Can you email me the URL to NuSOAP and the PEAR SOAP pages? Also, do you (or anyone) have any comparative information on these two methods/classes? Thanks again Chris. Good to hear from ya. Kris Boget, Chris wrote: 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 You might want to look into SOAP. It sounds like it will fit your needs very well. PEAR has a SOAP implementation that's still in testing and there is a class out there called NuSOAP that's supposedly very good. I just started toying around with it recently and it seems to work very well. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] receiving XML stream as server via PHP
Can you email me the URL to NuSOAP and the PEAR SOAP pages? I don't know much at all about the PEAR SOAP because it is still in testing. As for NuSOAP, I've just started using it myself and it seems to work well for what I've written so far. You can find NuSOAP here: http://dietrich.ganx4.com/nusoap/index.php Also, do you (or anyone) have any comparative information on these two methods/classes? Sadly, no. In fact, I'm relatively new to SOAP. I started looking into SOAP and PHP not too long ago and read about both NuSOAP and PEAR. Since PEAR was still in testing, I decided to fool around with NuSOAP and it's been working great. Of course, since I'm still so new, I could very well be doing things ass backwards. :p Thanks again Chris. Good to hear from ya. Not a problem. Hope this helps! Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] receiving XML stream as server via PHP
The variables will created (as of 4.x) in the $_POST and $_GET global arrays and you can then access them using what ever functions you need to use. As for XML if it is posted as raw you will get an error from Apache saying Bad Request. I have just setup an example to see what is possible to get around this... keep you posted. Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] HiTCHO | Open Platform Web Development Consutling - Outsourcing - Training - Support - Original Message - From: Kristopher Yates [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 01, 2003 7:20 AM Subject: [PHP] receiving XML stream as server via PHP 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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] receiving XML stream as server via PHP
You can post to your server with a mimetype of text/xml and in your script pickup the raw post as: $HTTP_RAW_POST_DATA Then just process this string as XML and return to buffer or not. Have fun. Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] HiTCHO | Open Platform Web Development Consutling - Outsourcing - Training - Support - Original Message - From: Kristopher Yates [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 01, 2003 7:20 AM Subject: [PHP] receiving XML stream as server via PHP 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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] receiving XML stream as server via PHP
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 You might want to look into SOAP. It sounds like it will fit your needs very well. PEAR has a SOAP implementation that's still in testing and there is a class out there called NuSOAP that's supposedly very good. I just started toying around with it recently and it seems to work very well. Chris