Forum Moderators: coopster
I'm busy trying to get some XML feeds for a client.
The way I am doing it is I have to post an XML string to an external URL or server using the action in a form.
This XML string includes a Doctype and other important stuff the other Server needs including a "returnURL".
Now when I post my form, it send the external server my request, which then proceeds to send the response in DTD and XML format to the returnURL I specified.
So I send from page A that goes to Server A that returns answer to page B.
Now how do I get to page B to get the response, process the XML and manipulate it? Any tools to receive XML in DTD and digest it I could use?
I've tried a redirect onsubmit in js but it's not working.
Thanks in advance!
[edit]sucky grammar[/edit]
[edited by: Pico_Train at 3:50 pm (utc) on Oct. 16, 2008]
a small script to help you start is:
<?php
$data_xml = ""; // put there some xml formatted data
$url = 'http://www.somesite.com/path/to/target/page';
$curlPost = 'data='.urlencode($data_xml );
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_HEADER, 0);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $curlPost);
curl_setopt($curlHandle, CURLOPT_TIMEOUT, 10);
$content = curl_exec($curlHandle);
curl_close($curlHandle);
echo $content;
?>
this will send your xml data to target server/page and retrieve their responce in $content
hope this will help you
I used your above code and modified the vars as needed for my purposes and I get this message from the server.
Error! Parser : Request XML ( oracle.xml.parser.v2.XMLParseException: Start of root element expected. Error No:4001)
I can't seem to find anything on that when searching for it with g00gle. Any ideas?