I am making a gaming panel with php where I need to read from a json api I have been reading on how to do this I need to get the value in the json api of banned
error_reporting(-1);
ini_set('display_errors', 'On');
$test = $steam->steamid;
$url = 'https://api.truckersmp.com/v2/player/' . $test;
$json = file_get_contents($url);
$api = json_decode($json);
echo $api->banned;
After running this I am receiving Notice:
Undefined property: stdClass::$banned in C:\xampp\htdocs\test.php on line 14
It should come back as a true or false value
I can view the array using var_dump