How to get value form array that have sbtClass
So, i use curl in php to get data trough API. This below is my code
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data02);
$resp = curl_exec($ch);
if($e = curl_error($ch)) {
echo $e;
} else {
$decode = json_decode($resp);
if(property_exists($stdClass, "code")) {
echo $stdClass->object;
}
}
curl_close($ch);
And the API result
object(stdClass)#2 (3) {
["result"]=>
bool(true)
["data"]=>
array(90) {
[0]=>
object(stdClass)#3 (6) {
["code"]=>
string(10) "VAL125-S45"
["game"]=>
string(8) "Valorant"
["name"]=>
string(10) "125 Points"
["price"]=>
object(stdClass)#4 (3) {
["basic"]=>
int(13390)
["premium"]=>
int(13325)
["special"]=>
int(13260)
}
["server"]=>
string(2) "45"
["status"]=>
string(5) "empty"
}
}
["message"]=>
string(35) "Success to get data."
}
The question is, how to get each value like for example "code" or "game" or "name"?