This is an updated and working piece of code that can be used to retrieve Facebook, for example, to count a specific page. To use this piece of code, you will need a Facebook application identifier and a secret key. This is used in version 2.8 of the API version.

Step 1:
Go to https://developers.facebook.com/ to log in to your facebook account. If you do not have it, you need to create it.
Step 2:
Created an application from the facebook developer.
Step 3:
You must get the App ID and App Secret from the application you created.

Step 4:
PHP code to get facebook as page count.
<?php function fbLikeCount($id,$appid,$appsecret){ $json_url ='https://graph.facebook.com/'.$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 if($json_output->fan_count){ return $fan_count = $json_output->fan_count; }else{ return 0; } } echo fbLikeCount('coregenie','___APPID___','___APPSECRET___'); ?>
Change the name of your page, application identifier, application secret.
This method works. Tested on 12/19/2017
Cecil paul
source share