How to receive arbitrary HTTP posted XML data in a php script
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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"
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.