I have an account id and location id, how to run the following script in Magento 2
<?php
$accountId = 'your_account_id';
$locationId = 'your_location_id';
$url = 'https://mybusiness.googleapis.com/v4/accounts/'.$accountId.'/locations/'.$locationId.'/reviews';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
/*If data is in xml format
$output = simplexml_load_string($output); */
$allData = json_decode(json_encode($output), TRUE); // You will get all the data
?>
I want to share these review details into my custom phtml file, what is the best approach to achieve this?