How to get Facebook likes count of a page using Graph API 2.8 Ver

This is an updated and working code snippet which can be used to retrieve Facebook like count of a specific page. To use this code snippet you’ll need a Facebook App ID and Secret Key. This use latest 2.8 API version method.

Step 1: 
Go to login with your facebook account. If you don’t have one you have to create one.
Step 2:
Created an app from facebook developer.
You have to get App ID and App Secret from app you created.

Step 4:
PHP Code to get facebook like count of a page.


function fbLikeCount($id,$appid,$appsecret){

 $json_url =‘’.$id.‘?access_token=’.$appid.‘|’.$appsecret.‘&fields=fan_count’;

 $json = file_get_contents($json_url);

 $json_output = json_decode($json);

 //Extract the likes count from the JSON object


 return $fan_count = $json_output->fan_count;


 return 0;



echo fbLikeCount(‘coregenie’,‘___APPID___’,‘___APPSECRET___’);


Please edit your page name , app id, app secret.

This method is working. Tested on 1/5/2017