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.

<?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;
?>

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

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest updates, web design resources and tools.

You have Successfully Subscribed!

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!

Pin It on Pinterest

Share This

Share This

Share this post with your friends!