I'm trying to build an application that will send an XML request, built from a search form, to a specific URL and then get the response to display it in the result page. I used cURL in order to send the XML file. The code I managed to write in this:
<?php
$postfields = '
<OTA_RQ Target="Production" SortOrder="A" IsModify="false" Version="1.003" TimeStamp="2006-01-13T11:51:50+02:00" EchoToken="token" xmlns="http://www.x-piral.com">
<Source>
<RequestorID ID="22" Type="5"/>
</Source>
<SearchCriteria>
<Address>
<Name Code="NICK"/>
</Address>
</SearchCriteria>
</OTA_HotelAvailRQ>
';
$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, 'http://www.x-piral.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$output = curl_exec($ch);
curl_close($ch);
print $output;
?>
It seems to be ok. It sends the XML but I get no response. In the output I can only see the Header of the response that looks like this:
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=UTF-8 Content-Length: 238 Date: Fri, 13 Jan 2006 13:03:15 GMT
Is there something wrong with my code? Thank you in advance!