I am working with Expedia’s api and I am trying to do a test booking. I have to call a https url. I have been able to make connections to all other normal http request, but now I am stuck. Here is how I am calling the page. all the php values from my form are correct but I get nothing in the xml file..I mean nothing no errors, nothing! I am truly stuck and do not know what to do. Here is my php code:
$ch = curl_init();
$fp = fopen('bookit.xml','w');
curl_setopt($ch, CURLOPT_URL, "https://book.api.ean.com/ean-services/rs/hotel/v3/res?cid=55505&minorRev=13&apiKey=4sr8d8bsn75tpcuja6ypx5g3&locale=en_US¤cyCode=USD&customerIpAddress=10.184.2.9&customerUserAgent=Mozilla/5.0+(Windows+NT+6.1)+AppleWebKit/535.11+(KHTML,+like+Gecko)+Chrome/17.0.963.79+Safari/535.11&customerSessionId=&locale=en_US¤cyCode=USD&xml=<HotelRoomReservationRequest><hotelId>".$hid."</hotelId><arrivalDate>".$arrive."</arrivalDate><departureDate>".$depart."</departureDate><supplierType>".$supplier."</supplierType><rateKey>".$rkey."</rateKey><rateCode>".$ratecode."</rateCode><roomTypeCode>".$roomcode."</roomTypeCode><chargeableRate>".$total."</chargeableRate><RoomGroup><Room><numberOfAdults>".$adults."</numberOfAdults><numberOfChildren>".$children."</numberOfChildren><childAges>".$childages."</childAges><firstName>".$fname."</firstName><lastName>".$lname."</lastName><smokingPreference>".$smoking."</smokingPreference></Room></RoomGroup><ReservationInfo><email>".$email."</email><firstName>".$ccname."</firstName><lastName>".$cclast."</lastName><homePhone>".$phone."</homePhone><workPhone></workPhone><creditCardType>".$cc."</creditCardType><creditCardNumber>".$ccnumber."</creditCardNumber><creditCardExpirationMonth>".$exmonth."</creditCardExpirationMonth><creditCardExpirationYear>".$exyear."</creditCardExpirationYear><creditCardIdentifier>".$ccsecure."</creditCardIdentifier></ReservationInfo><AddressInfo><address1>".$street1."</address1><city>".$city."</city><stateProvinceCode>AZ</stateProvinceCode><countryCode>".$country."</countryCode><postalCode>".$zip."</postalCode></AddressInfo></HotelRoomReservationRequest>");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/xml'));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
$val = curl_exec($ch);
curl_close($ch);//Close curl session
fclose($fp); //Close file overwrite
var_dump($val);
$data = simplexml_load_file('bookit.xml');
And I like I said I get nothing at all. I have checked all the code and I do not see a problem and the url is correct.. any help would be so greatly appreciated. Thanks in advance.
The customer IP addr is
10.184.2.9, you say? I’m skeptical of that.Immediately after the
curl_exec, but before you close$ch, echo the output ofcurl_error($ch). Is there anything useful there?