cURL giving 400 in response

SaraT

New Member
Hello to anyone willing to help.. I don't know what else to do. I am trying to send an xml request to an api which will give back an xml formatted response. I am using curl to achieve it. But no matter what way I format my request, I always get a 400 response. The url is formatted correctly. Here is my code:\[code\]$ch1 = curl_init(); $fp1 = fopen('poi.xml','w'); curl_setopt($ch1, CURLOPT_URL, "http://api.ean.com/ean-services/rs/hotel/v3/geoSearch?cid=55505&minorRev=14&apiKey=xkr94zxbsjnzczryqajmjg3g&locale=en_US&currencyCode=USD&customerIpAddress=189.214.86.135&customerUserAgent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31&xml=<LocationInfoRequest><destinationString>Dallas, TX</destinationString><type>2</type></LocationInfoRequest>"); curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch1, CURLOPT_HTTPHEADER, array('Accept: application/xml')); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch1, CURLOPT_FILE, $fp1); curl_setopt($ch1, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch1, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'); $val1 = curl_exec($ch1); $info = curl_getinfo($ch1); echo '<pre>'; print_r($info); echo '</pre>'; curl_close($ch1);//Close curl session fclose($fp1); //Close file overwrite $avail = simplexml_load_file('poi.xml');\[/code\]Here is the info I get back from curl:\[code\] => http://api.ean.com/ean-services...&apiKey=xkr94zxbsjnzczryqajmjg3g&locale=en_US
 
Top