There is a string whose var_dump()
shows:
object(stdClass)#1 (1) { ["response"]=> int(112) }
How do I get to 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; }
json_encode($json,true)
, put the last parameter to convert to an array, and work with it. - Naumov