Snippets

Display number of Facebook fans in full text

Paste the following snippet where you want your fan count to be displayed. Don’t forget your page id on line 2.

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

Source: http://www.wprecipes.com/display-number-of-facebook-fans-in-...

Share this snippet

 
  • http://www.fbside.com Iulia

    Thanks Jean for the tips, very easy code.