Aug
13
2011
13
2011
How to get number of friend (friend count) in facebook using graph api
In my previous blog I have told you that how to get the count for a fanpage. You can check it here.
Now today I will tell you how to get the friends of a friend using graph api..
I assume that you know the authentication process and all the basic
I assume that you are using the facebook official php sdk. That you can download from GITHUB.
So here is the function by which you can get the count or total friends for a particular user.
function fb_get_friendcount($user_id, $access_token, $count=false)
{
$fb = new Facebook(array(
'appId' => app_id,
'secret' => app_secret,
'cookie' => true, // enable optional cookie support
));
$result = $fb->api("/".$user_id."/friends",array("access_token"=>$access_token));
if($count == true)
return count($result["data"]);
else
return $result["data"];
}
Here we will pass the count parameter FALSE if we need only the count of friends and if we need a complete array we do not need to pass the third parameter
Hope this will help
. Feel free to ask any question
Related Posts
8 Comments + Add Comment
Leave a comment
Recent Comments
- liberty reserve on FBJS ( Intro to facebook javascript )
- Landscaping Hockessin on FBJS ( Intro to facebook javascript )
- landscaping Hockessin de on Difference between Article and Press Release writing
- ocean city hotels on FBJS ( Intro to facebook javascript )
- wilmington delaware real estate on Difference between Article and Press Release writing
An article by Muhammad Farhan Bashir





Pretty insightful. Thanks!
My blog:
solution rachat credit http://www.rachatdecredit.net
Wow! Really great post came across it on Google. This aricle is extremely interesting . You seem to be a very experienced blogger I’m actually new to blogging and I recently made a website . Thanks alot!!
This blog post gives the light in which we can observe the reality.
It is hard to find knowledgeable people on this topic however you sound like you know what you are talking about! Thanks
hey there and thanks on your info ? I have definitely picked up anything new from proper here. I did alternatively experience several technical points the use of this website, since I experienced to reload the web site a lot of occasions prior to I could get it to load properly. I have been brooding about in case your hosting is OK? Not that I am complaining, however sluggish loading instances instances will often impact your placement in google and can damage your quality rating if ads and ***********
thanks for providing me such info. that could be problem with my hosting.. I will definitely contact them for this issue
hey buddy, this is a very interesting article
Wow, this is cool. I?m glad I found this article since I was interested in tracking my keyword rankings. Thanks dude!