I am trying to access a property called 'ChatId' that is returned in the curl_exec command to the variable server_output.
$server_output = curl_exec($ch);
$output = json_decode($server_output, true);
After this I tried running:
var_dump(get_object_vars($output));
But $output is actually an array and not an object. So when I run var_dump($output) I get the output:
array(1) {
["Chats"]=>
array(1) {
[0]=>
array(1) {
["Chat"]=>
array(3) {
["ChatId"]=>
int(11845)
["UserId"]=>
string(16) "d9729feb63a1a015"
["SystemId"]=>
string(33) "d9729feb63a1a015~434534343"
}
}
}
}
The only property I want to access is the ChatId property but I am having difficulty doing so.
$output["Chats"][0]["Chat"]["ChatId"]