Skip to main content

Facebook Fan page Count in Simple Text HTML

Step 1 – Get API Key, Application Secret & Page ID

These are the three mandatory information you’ll need to get things started.

API Key and Application Secret

  1. Sign in to your Facebook and click on Developer‘s link on the site bar. (If you don’t have a Developer’s account, you will have to sign up for one first)

    facebook developer link How to Display Facebook Fan Count in Text

  2. Click "Set Up New Application". Enter any application name, agree to the Facebook terms and click "Create Application". Note: We are not going to create a real application, but we’ll need to go through these processes to get a API Key and Application Secret.
    create application How to Display Facebook Fan Count in Text
  3. On the next page, you should be able to see your personal API Key and Application Secret. Copy it down somewhere or leave the browser window open.
    api key How to Display Facebook Fan Count in Text

Page 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 – http://www.facebook.com/pages/edit/?id=XXXXXXXXX

Step 2 – Get Facebook.php

You’ll also need the Facebook API PHP SDK file called Facebook.php. Download it, and place it in the root of your folder. Learn more about Facebook PHP SDK.

php sdk How to Display Facebook Fan Count in Text

Step 3 – Display Fancount

To show off your fancount, place the following code in your php file,



<?php

require_once('facebook.php');

$facebook = new Facebook(array(

'appId' => 'app_id',

'secret' => 'secret_key',

'cookie' => true,

));

$result = $facebook->api(array(

'method' => 'fql.query',

'query' => 'select fan_count from page where page_id = page_id;'

));

$fb_fans = $result[0]['fan_count'];

?>


Link to get codes


And then you will want to edit the codes to change the following:

Line 4 – Replace app_id with your Facebook Application ID.

Line 5 – Replace secret_key with Secret.

Line 10 – Replace the last page_id with your Facebook Fanpage ID.


<?php echo $fb_fans; ?>


Please refer to Step 1 on how to get app_id, secret_key and page_id.

To display the fancount, insert this following code anywhere in the page:

********************************************

Source : http://www.hongkiat.com/blog/how-to-display-facebook-fan-count-in-text/

********************************************

Comments

Popular posts from this blog

Blogged: චන්නට මොකද උනේ ? චන්න ඇයි මෙහෙම කරගත්තෙ ?

ඊ.බී. චන්නව මා හඳනාගන්නේ 1994 වසරේදීයි එවකට මම පාසල් ශිෂ්‍යයෙක්, සෑම පාසල් ක්‍රීඩකයෙකුම සිහින මැව්වෙ, චන්න වගේ පාපන්දු ක්‍රීඩකයෙකු වෙන්න.  ඔහු මුලින්ම ජාතික තලයට පිවිසෙන්නේ, වයස 18 න් පහළ ශ්‍රී ලංකා කණ්ඩායම නියෝජනය කරමින් ඉන්දියාවේ පැවැති තරගාවලියකට සහභාගීවෙමින්, ඔහු ගාල්ල යූත් ගාල්ල යුනයිටඩ් ක්‍රීඩා සමාජ දෙකම විටින් විට නියෝජනය කල අතරම, ඔල්ඩ් ජෝස් ( මරදාන ආදි ශාන්ත ජෝසප් ) කණ්ඩායම නියෝජනය කලා. පාසල් සමයේම දක්ෂතා ගොන්නක් එක්ක පීදුනු මෙම ක්‍රීඩකයා ප්‍රධාන පෙලේ තරග වලට පිවිසුනේ   , පෙටා යුනයිටඩ් හා වික්ටර් ක්‍රීඩා සමාජ වලින්.  ජාතික කණ්ඩායම වසර 15 කට අධික කාලයක් නියෝජනය කරපු චන්න මෙරට ඇති බොහෝ ක්‍රීඩා සමාජ වල ප්‍රධාන සාමාජිකයෙක් වුණා. ඒ වගේම මාලදිවයින, ඉන්දියාව, බංග්ලාදේශය වගේ රටවලත් ක්‍රීඩා සමාජ තරගවලට ක්‍රීඩා කරපු චන්න දැන් ඉන්නේ ගාල්ල නගර සභාවෙ සුලු සේවකයෙකු විදියට ලු..  දැනටත් කලුතර බ්ලූස්ටාර් කණ්ඩායමේ සාමාජිකයෙකු වන චන්නට මෙහෙම වුනේ ඇයි ?  ඔහු  අතීතයෙන්, වර්තමානයට හෝ අනාගතයට අයෝජනයක් කර ගෙන නැත. ඉහළ සාමාජ තත්වයක් සකසා ගැනීමේ හැකියාව මෙන්ම අත්දැකීම්...

Best 6 Way to filter your feeds

There are many ways to filter news feeds from your favorite sources, including passively by relying on meme trackers like Techmeme or social news services such as Google Reader's shared items. We've also taken a look in the past at automatic filters such as Feedhub ( our coverage ) which learns from your behavior to suggest posts, or AideRSS ( our coverage and here ), which uses outside metrics to determine which items in an RSS feed are the "best." For the purpose of this post, however, we'll focus on services that let you filter by keyword. Feed Rinse is a best of class RSS filtering application. It offers filtering by keyword, tag, author, title, etc. It supports regular expressions, has a built in profanity filter, and lets you upload your OPML file for easy importing of your RSS feeds (it can also export to OPML). And since we first covered it in April of 2006 it has gone completely free. FilterMyRSS is a no-nonsense keyword fil...

Blogged #Gammadda - සල්ලි එපා වන්දි එපා මාලුයි ඕන...

මේ කතාව මට නුපුරුදුයි...  සල්ලි ඉල්ලන වන්දි ඉල්ලන රජයට බනින මිනිස්සු ඉන්න රටේ මේ වගේ ඉල්ලීමක්... අම්පාර පොතුවිල් වලට ළඟ රොට්ටේ ප්‍රදේශයේ පෞරාණික කොවිලක් අසලට ගිය විට කෙනෙක් ඇවිත්...  සර් පොඩි ප්‍රශ්නයක් තියනව. ඇවිල්ල බලනවද ඇහුව..  ප්‍රශ්න නැත්තෙ කාටද යමුකො බලන්න.. මඩ වතුර පිරුණු වැවක් ළඟ ධීවරයන් පිරිසක් අමුතු කතාවක් කියන්න වුණා... "මේ වැව දැන් හිඳිල, මේ වටේට ලොකුවට කරන කුඹුරු තියනව. මේ ගමේ අයට කුඹුරු අක්කර භාගයක් තියා එදා වේල කන්න සල්ලි නෑ. මේ හැම පවුලම රැකෙන්නෙ වැවෙන් අල්ලන මාලු වලින්. අපිව මාලු අල්ලන මිනිස්සු නිසා ගණන් ගන්නෙත් නෑ" අපි සංගමයක් විදියට එකතුවෙලා වැහි කාලෙ අාපු ගමන් මාලු පැටව් සල්ලිවලට අරන් වැවට දානව. ඒ මාලු ලොකු උණාම අල්ලනව ඒත් ලොකු දැල් දාල. මොකද මාලු පැටව් පරිස්සම් කරගන්න ඕන.  දැන් අවුරුදු දෙකක් තිස්සෙ පෑවිල්ල. ඒ මදිවට තියන වතුර සේරම කුඹුරුවලට ඇරල මාලුන්ට ජීවත්වෙන්න බෑ. වැව හිඳෙද්දි මාලු මැරෙනව. ලුණු ගතිය වැඩි වෙනව. දැන් කොක්කුයි පිට රටෙන් ඇවිල්ල ඉන්න කුරුල්ලොයි ඉතුරු මාලු පැටව් කනව. මේ අවුරුද්දම ඉවරයි. අපේ ගෑණුන්ගෙ කණ...