There is a code:

<?php $url = 'https://api.vk.com/method/friends.get?user_id=185610037&count&access_token={access_token}&v=5.60'; $users = json_decode(file_get_contents($url)); print_r( $users ); ?> 

Issues:

 stdClass Object ( [response] => stdClass Object ( [count] => 1286 [items] => Array ( [0] => 232578 [1] => 342835 [2] => 936371 [3] => 1270059 ... 

I can’t figure it out in any way so that only the number [count] issued

  • print_r ($ users-> count); - Boris
  • Hello, changed, but now just a white screen <?php $url = 'https://api.vk.com/method/friends.get?user_id=185610037&count&access_token={access_token}&v=5.60'; $users = json_decode(file_get_contents($url)); print_r($users->count); ?> <?php $url = 'https://api.vk.com/method/friends.get?user_id=185610037&count&access_token={access_token}&v=5.60'; $users = json_decode(file_get_contents($url)); print_r($users->count); ?> <?php $url = 'https://api.vk.com/method/friends.get?user_id=185610037&count&access_token={access_token}&v=5.60'; $users = json_decode(file_get_contents($url)); print_r($users->count); ?> - Funxu
  • $users->response->count - Zippbl4

1 answer 1

I solved the issue, just using a different method, this is what happened:

 <?php $result = json_decode(file_get_contents('https://api.vk.com/method/users.get?user_id={id}&fields=counters&access_token={token}&v=5.60'. $get_params)); //echo ($result[0]) //echo ($result -> response[0] -> counters[0] -> friends); print_r($result -> response[0] -> counters -> friends); ?> 

And he gives exactly the number.