Get the Number of Facebook Fans & Display it on your website

By | January 25, 2012

Facebook Page likes

If you are a Facebook page user and want’s to get the number of Facebook page like in your blog this code might help.First you need to know your Facebook page id.The Facebook page id can be got by the graph API.
https://graph.facebook.com/livetut.org

Like Facebook
Change the livetut.org to your Facebook page extension.

 <?php
	$page_id = "214839665228900";
	$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;
?>

Copy and paste the code on your blog or website where you want to see the Facebook Page likes.
Remember to change the Facebook $page_id.
Live Demo at the Home Page footer.

One thought on “Get the Number of Facebook Fans & Display it on your website

  1. Jennifer Wiss

    Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future… Plagiarism detection

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.