I want to get all the Facebook pages and their fan count of user accounts using Facebook graph API, I also create one app in Facebook developer account, but then after don't know what to do to get page list?
So, can someone help me to write the correct PHP code to retrieve the page list?
I had some code as below :
$json_url ='https://graph.facebook.com/'.$page_id.'?access_token='.$fb_api_key.'|'.$fb_api_secret.'&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){
echo $fan_count = $json_output->fan_count;
}else{
echo 0;
}`