Could someone help with the following i'm trying to parse out some results from an API at https://www.amee.com/api#/documentation, im not exactly a guru at this so would like some help.
I can retrieve all the data using var_dump in what looks like json but when trying to parse it out in html i get the below error
Notice
: Trying to get property 'Company' of non-object in
C:\xampp\htdocs\smbprotool\api\funcions.php
on line
90
Warning
: Invalid argument supplied for foreach() in
C:\xampp\htdocs\smbprotool\api\functions.php
on line
90
This is my code on my functions.php file
function get_company_detail_amee() {
$url = 'https://www.amee.com//api/companies?min_annual_sales_local=1000000';
$username = '******';
$password = '******';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$array = json_decode($response, true);
foreach($array->Company as $p){
echo "<h6> ". $p->amee_company_id ."</h6>";
}
}
Any help is appreciated