I have the below code and what I am trying to do is get the json value from "total_reviews" into a php variable which we can call $total_reviews.
however what is happening is i am getting an error that says
Notice: Undefined property: stdClass::$total_reviews
Here is my code
//URL of targeted site
$url = "https://api.yotpo.com/products/$appkey/467/bottomline";
// Initiate curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
$data = json_decode($result);
echo "e<br />";
echo $data->total_reviews;
// close curl resource, and free up system resources
curl_close($ch);
?>
If I print_r the result I have the below print out
{"status":{"code":200,"message":"OK"},"response":{"bottomline":{"average_score":4.2,"total_reviews":73}}}