Jump to content

How to send a XML document using PHP POST method


Alexancho

Recommended Posts

It depends...What are you doing? Where did you get the forumlation of this task? For what?You need to output something from PHP, or are you getting something to PHP by something else?The whole statement is full of terms you need to understand. Read up on how HTTP works (wikipedia), and do some tests with Fiddler (see my signature) or a similar tool, and as you're reading the Wikipedia page, look carefully at Fiddler's "Raw" tab.

Link to comment
Share on other sites

It depends...What are you doing? Where did you get the forumlation of this task? For what?You need to output something from PHP, or are you getting something to PHP by something else?The whole statement is full of terms you need to understand. Read up on how HTTP works (wikipedia), and do some tests with Fiddler (see my signature) or a similar tool, and as you're reading the Wikipedia page, look carefully at Fiddler's "Raw" tab.
I am creating a page that is some kind of a mediator between different pages.My page receives a data from submitted form, creates XML document and sends it to another page (in different server).After that my page receives an answer, also as XML. So, it is exchange of XML documents and data processing.But there are only 2 or 3 kinds of a documents. I mean it is some standard documents, let say some information about clients. Only some data inside changes.
Link to comment
Share on other sites

Oh... so it's both from and to PHP... all the more reason you should read up on HTTP then. I can't say it any clearer than "The XML document must be transmitted in the 'body' of the POST request as content type text/xml" without going in detail explaining what "body", "POST", "content type" mean, and even then, it's not guaranteed you'll know how to do what you're trying to do.The only thing I can say in addition to the materials above is that if you understand the process, you can use cURL or pecl_HTTP (which uses cURL under the hood) to send HTTP requests.And BTW, I'd say "application/xml" is a better type to use, but that's probably not helpful just yet.[edit]Actually, you know what... if you can get the pecl_HTTP extension, you don't need to know anything. Just install it and use HttpRequest::addPostFile(). You can clearly see all of the terms above reflected in the method.[/edit]It's not exactly clear to me... are you trying to use SOAP, or do you want to do plain HTTP requests? Neither approach is better for everything, but each is better for specific purposes. SOAP is better if you want to emulate class methods in one language/server to another language/server (a.k.a. RPC calls), whereby the "capable" server does the actions and returns a result to the other server (which is considered a "client" from SOAP's perspective). Plain HTTP requests are better for... pretty much everything else.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...