Skip to content

Instantly share code, notes, and snippets.

@RoverWire
Created January 27, 2016 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoverWire/01194e4e9edca79392a0 to your computer and use it in GitHub Desktop.
Save RoverWire/01194e4e9edca79392a0 to your computer and use it in GitHub Desktop.
This snippet will help you to get your Facebook fan count, in full text. Your page ID can be found at the address http://facebook.com/yourpagename/info.
<?php
$page_id = "302807633129400";
$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