Until few weeks ago I was able to get subscriber count & friend count for personal accounts in Facebook. Here's the code I used:
$userid = '543766397';
$url = file_get_contents('http://api.facebook.com/method/fql.query?format=json&query=select+subscriber_count,+friend_count+from+user+where+uid%3D'.$userid);
$decode = json_decode($url);
$fb['subscriber_count'] = $decode[0]->subscriber_count;
$fb['friend_count'] = $decode[0]->friend_count;
Facebook has made changes to their service and the code above isn't working any more. I've tried to find solution this problem for several days but it seems that either I don't know how to find the answer or I'm alone with my problem. I know that FQL queries are legacy way of doing things and most likely feature is deprecated but I haven't found any working solution.
Any assistance would be highly appreciated!
First of all, the
subscriber
edge is deprecated since Graph API v2.0. You're calling the also deprecated REST API. You can also no longer get the friend count without having a User Access Token containing theuser_friends
permission.Once you have that, you can call
/me/friends
to receive thetotal_count
:See