Answer the question
In order to leave comments, you need to log in
Displaying the number of followers of a Facebook page?
Tell me, before the output of the number of subscribers worked like this
<?php echo get_facebook_page_likes('id page');?>
function get_facebook_page_likes($page_id, $echo=false){
$xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("много");
$likes = $xml->page->fan_count;
if($echo == true){
echo $likes;
} else {
return $likes;
}
}
Answer the question
In order to leave comments, you need to log in
Try the current API:
echo get_facebook_page_likes('page id');
function get_facebook_page_likes($page_id) {
$url = 'https://graph.facebook.com/v2.11/'.urlencode($page_id).'?fields=fan_count&access_token=ТОКЕН';
$data = json_decode(file_get_contents($url));
return $data->fan_count;
}
ТОКЕН
:AppID|AppSecret
, where AppID is the identifier of the created application, AppSecret is the application's secret key.Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question