I am fetching data from thirdparty API using CURL in php. I have read the documentation and passing the same valid parameters to the request but nothing works.
I am showing the code removing "API KEY" due to confidentiality.
$service_url = 'https://api.birdeye.com/resources/v1/business/147197756121167?api_key=ApiKeyGoesHere';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
if ($curl_response === false)
{
$info = curl_getinfo($curl);
curl_close($curl);
echo '<pre>';
die('error occured during curl exec. Additioanl info: ' . var_export($info));
}
curl_close($curl);
$decoded1 = json_decode($curl_response,true);
if (isset($decoded1->response->status) && $decoded1->response->status == 'ERROR')
{
die('error occured: ' . $decoded1->response->errormessage);
}
echo 'response ok!';
var_export($decoded1->response);
?>
response ok!NULL
http://docs.birdeye.apiary.io/#reference/business/get/get-business
Try this with your api key
$urltopost = 'https://api.birdeye.com/resources/v1/business/147197756121167?api_key=ApiKeyGoesHere';
$header=array("content-type"=>"application/json");
$ch = curl_init ($urltopost);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$returndata = curl_exec ($ch);
$status_code = @curl_getinfo($ch, CURLINFO_HTTP_CODE);
print_r($status_code);
print_r($returndata);