Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-09-2006, 04:48 PM   #1
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
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
Old 03-09-2006, 05:42 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
This sounds like AJAX, which uses javascript. I think something similar is mentioned on this webpage:
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"

Last edited by jschiwal; 03-09-2006 at 05:45 PM.
Old 03-10-2006, 11:36 AM   #3
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Original Poster
Rep: Reputation: 38
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?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
need to get data from xml file to MySQL database, and then use php to access Armon Linux - General 1 01-18-2006 02:54 PM
I must configure what to receive emails posted to me hicham007 Linux - Newbie 5 06-23-2005 03:47 PM
Paging data from XML with PHP Boby Programming 1 03-23-2005 09:57 AM
How do I access the request data POSTed by client? jayashrik Programming 3 03-04-2005 04:13 PM
using data posted by LQ-ers for an school asignment schatoor LQ Suggestions & Feedback 2 10-17-2003 08:31 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration