I try to code a output from a API.
So I took this at first:
$api_response = json_decode(file_get_contents("--LINK TO API--"));
if I var_dump the $api_response, a code like
object(stdClass)#1 (3) {
["status"]=>
string(2) "ok"
["count"]=>
int(1)
["data"]=>
array(1) {
[0]=>
object(stdClass)#2 (4) {
["clan_id"]=>
int(1000001876)
["nickname"]=>
string(10) "JakenVeina"
["id"]=>
int(1001147659)
["account_id"]=>
int(1001147659)
}
}
}
So if I want to output for example only the account_id, I tried more ways:
$account_id = $api_response["data"]["account_id];
echo $account_id;
and
echo $api_response->account_id;
Nothing worked for me. Does anyone have an idea?