PHP Reads XML Posted to my PHP Page -
I have a PHP page that needs to be posted on the XML page. The post content will be done by type: application / xml (no application / x-www-form-urlxode)
For example, my page is called test.php, another server on this page XML will post (test.php). My question is how can I create a code to post an XML on this test.php page?
UPDATE
First of all, thank you very much and for the time spent helping me, I will try to improve my problem Messenger I am using a platform named "Botplattform". Here's more information:
Actually this platform works like this: I have my Instance Messenger (in this case MSN) I type a message, the message that I Has Aip is sent by XML Post on my PHP page. This describes how the platform does this:
"Request posting content type app / XML (not application / x-www-form-urlxode). Therefore you should read the whole body In the form of XML data, you could not read any parameters. "
To read this XML file, type" user type on MSN "and I send my reply to Botplatform Message to the user who Sends.
I can send a reply to Botplatform, but I can not read the XML that sends the Botplatform my php file. / P>
If you want to test, just talk to your menuframe (at) exqued (dot) com (dot) br or your MSN. It will only respond to "AM Manuentka" but it works, PHP creates an XML and resonates it.
php: // input
stream. From:
php: // input
allows you to read rawPOST
data There is a low memory intensive option for$ HTTP_RAW_POST_DATA
and no special php.ini instructions are required. Not available withphp: // input
enctype = "multipart / form-data"
.
Update : Maybe some examples may help.
Here is a simple script I input.php
:
& lt; Php echo file_get_contents ('php: // input'); ? & Gt; Use the CRL as a command line: curl-d "& lt; xml & gt; & lt; luggage & gt; test & Lt; / stuff & gt; & lt; / xml & gt; "Http: //localhost/input.php
Also set content type:
Curl-H "Content-Type: App / XML" - <...
Output is (expected): & lt; Xml & gt; & Lt; Accessories & gt; Trial & lt; / Stuff & gt; & Lt; / Xml & gt;
If you try to do the Upload file, which is usually enctype
to Multipart / form can be set -data (note, no content-type
) you will not find anything.
Sample file ( test.xml
):
Upload the file using cURL:
Curl-F "name=@test.xml" http: //localhost/input.php < / Code>
curl -f "name=@test.xml; type = application / xml" http: //localhost/input.php
Both outputs will be nothing from input.php
However, if you modify the script to see the $ _ FILES
array (or you normal < / Em> will process the upload on PHP), then you will get the content.
I will call the new script form.php
:
File upload with curl:
curl -f "name=@test.xml; type = application / xml" http: // localhost / Form.php
test.xml
.
You have to compromise Second Update : application / xml
between these two methods $ _FILES
by working, but then you are working again on php: // input
:
< Code> curl -F "name=@test.xml" -h "content-type: app / xml"
Comments
Post a Comment