LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to receive arbitrary HTTP posted XML data in a php script (https://www.linuxquestions.org/questions/programming-9/how-to-receive-arbitrary-http-posted-xml-data-in-a-php-script-423292/)

rstewart 03-09-2006 04:48 PM

How to receive arbitrary HTTP posted XML data in a php script
 
Hi all,

I am trying to write a php script file that will be started as the result of a completely different application sending a TCP/IP message containing an HTTP POST request made up of XML formatted data to port 80 of a server. The post will specify the name of the php script file that should be executed to receive and process the XML data being sent, along with the actual XML data of course.

My problem is fairly simple. I am really not sure where to begin. The script really isn't a form with fixed action items, and the contents of the data can be dynamic.

I have tried googleing for anything having to do with posting XML data to php, and have encountered numerous articles saying how to use php to parse an XML file (close - but the data is coming in via the POST and not a local file), and how to use php to output XML formatted data (no brainer there). However I haven't been able to find any information saying what is involved in writing a php script to be the receiver of externally posted XML data.

Does anyone know of any tutorials or sample code that could assist me in solving my problem?

Thanks much!
-Bob Stewart

jschiwal 03-09-2006 05:42 PM

This sounds like AJAX, which uses javascript. I think something similar is mentioned on this webpage:
http://www.dynamicdrive.com/dynamici...jaxroutine.htm
Quote:

Ok, still using the original callback function above, processGetPost(), I'll show you a sample usage of using Ajax POST to send arbitrary information from the page to a PHP script asynchronously.
I found this with the Google search "php xml asynchronous"

rstewart 03-10-2006 11:36 AM

Thank you very much for responding jschiwal, unfortunately that example does not help me.

I don't have any problem generating, or sending the asynchronous XML data. I have a very generic sockets based client application that constructs the XML data, establishes a connection to the server's port 80, and sends the XML data as an HTTP POST. My problem is that I'm not sure how to code the server side of the conversation that responds to the asynchronous POST of the XML data using a php script. And unfortunately I must use php on the server side, as I am going to need to process the received XML data and update various mySql databases that reside on the server/host. Using php is the easiest way I can think of to do that.

Any other suggestions?


All times are GMT -5. The time now is 08:17 PM.