Code Snippet

Display Number of Facebook Fans in Text


Social media marketing is the best part of the website promotion. It gives you quality traffic and helps to build readership. If you have a Facebook fan page for your blog or website it helps you to reach out to more potential reader. If you get Facebook page has more number of users, it is more likely to attract more users. People generally go for those pages which already have more number of member.

If you also have a Facebook page for your website, showing user count is the best idea to attract more number of users for your Facebook page. If you to show only the count of fan page followers, this code snippet is for you.

This PHP code will show the exact count of Facebook followers of you Facebook page.


Add your Facebook page id at the place of PAGE_ID_HERE at the second line of the code.

$page_id = “YOUR PAGE-ID”;
$xml = @simplexml_load_file(“”.$page_id.””) or die (“a lot”);
$fans = $xml->page->fan_count;
echo $fans;

If you have any problem in implementing the code, let me know via comments.

See more code snippet:

Create And Download ZIP File With PHP
Simple JQuery Lightbox Effect Tutorial


To Top