1

I am using the following code to get list of friends in my friend list on Facebook :

//get the user's access token
$access_token = $facebook->getAccessToken();
//check permissions list
$permissions_list = $facebook->api(
   '/me/permissions',
   'GET',
   array(
      'access_token' => $access_token
   )
);

$frnds=  $facebook->api('/me/friends');
echo sizeof($frnds['data']).'<br>';
foreach($frnds['data'] as $frn)
{
   echo $frn['name'].'<br>'; 
}

The no. of friends i.e. sizeof($frnds['data']) comes out to be less then the friends actually displayed on my facebook profile. I wonder WHY?

Rushil Sablania
  • 526
  • 4
  • 15
  • you use graph api. really, facebook said this: "you can get not greater than 25 items per request if you don't use 'offset&limit' - properties". actually, if you get friends of yourself, your result will be less than expected. – gaussblurinc Oct 25 '12 at 10:20
  • @loldop - I tried using `$frnds= $facebook->api('/me/friends?limit=1000');` but still showing 850 friends instead of 934 friends. – Rushil Sablania Oct 25 '12 at 11:16
  • it is normal, really. you need to use "paging" property, which come with facebook response. i think, it is not null – gaussblurinc Oct 25 '12 at 11:19
  • 2
    This is why: http://facebook.stackoverflow.com/questions/11135053/fetching-list-of-friends-in-graph-api-or-fql-appears-to-be-missing-some-friend – Donn Lee Oct 25 '12 at 22:02

0 Answers0