Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

friend list in facebook

Tags:

php

facebook

I am trying to fetch friend list. I wrote following code..

$friends = $this->facebook->api('me/friends');
echo count($friends);

Answer was 1. (though it should have been 456). What am I doing wrong? Thanks for help.

like image 527
mihsathe Avatar asked Jan 03 '11 13:01

mihsathe


1 Answers

The data structure returned by the API is different than you think. Try echo count($friends['data']); instead.

like image 89
Klaus Byskov Pedersen Avatar answered Oct 02 '22 18:10

Klaus Byskov Pedersen