I try to call an expedia xml webservice in php, using curl. But how to send the XML data with post
sample request
<BookingConfirmRQ xmlns="http://www.expediaconnect.com/EQC/BC/2007/09">
<Authentication username="mytestusername" password="mypwd"/>
<Hotel id="7224658"/>
<BookingConfirmNumbers>
<BookingConfirmNumber bookingID="252743459" bookingType="Book" confirmNumber="E2340589B" confirmTime="2013-12-30T23:45:00Z"/>
</BookingConfirmNumbers>
</BookingConfirmRQ>
response
<BookingConfirmRS xmlns="http://www.expediaconnect.com/EQC/BC/2007/08">
<Success/> OR FAIL
</BookingConfirmRS>
my code part
$curl = curl_init();
$url ="https://services.expediapartnercentral.com/eqc/bc";
$data = array();//What will be data here and which formate
switch ($method)
{
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_PUT, 1);
break;
default:
if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}
// Optional Authentication:
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "MYusername:MYpassword");
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
I am confused about What will be POST DATA here and which format? Is it right approach to use CURL or I have to use SoapClient() here? Please share your idea and solution. thanks