Parking stdClass
-
There's a line,
var_dump()
which shows:object(stdClass)#1 (1) { ["response"]=> int(112) }
How do I get to the field?
112
?Full code:
$ress = sendMessege($text, $user_id);
function sendMessege($text, $id) {
$url = "https://api.....";
$data = curlGet($url);
return $data;
}function curlGet($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_URL, $url);
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
-
You received an answer in the form of an object:
$data->response
For the answer to convert into a mass, try:$ret = (array)$data;