Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
URL and cURL access different when accessing a web aPI. Am I missing headers or something because the cURL php only outputs "''" rather than the URL output from below

What I have tried:

I have this URL access : http://bookings.seawings.ae/remoteconnect/default.asp?XML=%3Ccs%3E%0D%0A+%3Co+n%3D%22authenticationcode%22+v%3D%22d657cce7fa320a23950dca157fe693b8%22%2F%3E%0D%0A+%3Cc+n%3D%22flightsearch%22%3E%0D%0A++%3Cq+n%3D%22StartDate%22+v%3D%2211-Apr-2012%22%2F%3E%0D%0A++%3Cq+n%3D%22EndDate%22+v%3D%2211-Apr-2014%22%2F%3E%0D%0A++%3Cq+n%3D%22Typeofflight%22+v%3D%22SILVER%22%2F%3E%0D%0A++%3Cq+n%3D%22Seats_Adult%22+v%3D%228%22%2F%3E%0D%0A+%3C%2Fc%3E%0D%0A%3C%2Fcs%3E
and it returns :
<cs> <c n="flightsearch">
but when I try to run it in PHP:
<?php $request_xml = '<cs> <o n="authenticationcode" v="d657cce7fa320a23950dca157fe693b8"/> <c n="FlightSearch"> <q n="StartDate" v="1-Jul-2013"/> <q n="EndDate" v="30-Jul-2013"/> <q n="Seats_adult" v="3"/> </c> </cs>';
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://bookings.seawings.ae/remoteconnect/default.asp'); //curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSLVERSION, 3); curl_setopt($ch, CURLOPT_TIMEOUT, 4); curl_setopt($ch, CURLOPT_POSTFIELDS, $request_xml); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); $result = curl_exec($ch);
echo stripslashes($result);
curl_close($ch);
?>

it only returns: "''"
I tried using Curl. Am I missing headers or something?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900