Created
July 4, 2015 22:18
-
-
Save Shaz3e/15e06d20d225f79756a8 to your computer and use it in GitHub Desktop.
Display number of Facebook fans in full text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you have a Facebook page for your website or blog, you might want to display how many fans you have. This snippet will help you to get your Facebook fan count, in full text. Don’t forget to add your page ID on line 2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$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; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment