I am sending an API request using CURL but cannot receive the request. The API works well when you call it directly in the browser.
Here's the link
http:
my curl code is here
$post_string1 = "cid=55505&minorRev=99&apiKey=5d9cp7nfxruc7p788fvvqpwn&locale=en_US¤cyCode=USD&type=xml&hotelId=123912";
$path1 = "http://api.ean.com/ean-services/rs/hotel/v3/info";
$ch1 = curl_init($path1);
$fp1 = fopen('hotel.xml','w');
curl_setopt($ch1, CURLOPT_POSTFIELDS, $post_string1);
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);
$val = curl_exec($ch1);
$info = curl_getinfo($ch1);
curl_close($ch1);
fclose($fp1);
echo '<pre>';print_r($info);
I get the http 405 code. Please advise what I do wrong.
source
share