I can now show you a much simpler way to display your Facebook fan count as text on your website. It is alot simpler than the previous way, although it is entirely up to you how you wish to display it.
STEP 1 – FIND OUT YOUR FACEBOOK PAGES ID
Page ID is the ID of your Facebook Fan Page. If you don’t have a Facebook Fan page, you’ll have to first create one. To get the ID of your Fan page, click edit page, and look for your ID (numbers) at the end of the URL – eg: http://www.facebook.com/pages/edit/?id=XXXXXXXXX
STEP 2 – COPY AND PASTE
Copy and paste the code below anywhere within your website where you would like the Fan count to show. Remember to change the “XXXXXXXXXXXX” to your Facebook Pages ID.
There you have it, a much simpler way of displaying your fan count!
STEP 1 – FIND OUT YOUR FACEBOOK PAGES ID
Page ID is the ID of your Facebook Fan Page. If you don’t have a Facebook Fan page, you’ll have to first create one. To get the ID of your Fan page, click edit page, and look for your ID (numbers) at the end of the URL – eg: http://www.facebook.com/pages/edit/?id=XXXXXXXXX
STEP 2 – COPY AND PASTE
Copy and paste the code below anywhere within your website where you would like the Fan count to show. Remember to change the “XXXXXXXXXXXX” to your Facebook Pages ID.
<?php
$page_id = "XXXXXXXXXXXX";
$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;
?>
There you have it, a much simpler way of displaying your fan count!
Comments
Post a Comment