Home  >  Article  >  Backend Development  >  让PHP显示Facebook的粉丝数量方法_php技巧

让PHP显示Facebook的粉丝数量方法_php技巧

WBOY
WBOYOriginal
2016-05-17 08:51:341907browse

如果你的网站或者博客上有内链的Facebook页面,你或许想知道拥有多少粉丝。这段代码将帮助你查看Facebook粉丝数,记住,别忘了在你的页面ID第二行添加该段代码。

复制代码 代码如下:

$page_id = "YOUR PAGE-ID";
$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 ("a lot");
$fans = $xml->page->fan_count;
echo $fans;
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn