How To Display Feedburner Subscriber Count In Text

text feedcount

I believe you’ve seen websites and blogs that uses the text-based Feedburner subscriber count instead of the chicklet. I hope you are not getting the idea the these guys update their feed count manually. Instead, it can be done easily with scripts, and the reason why you want to do is - it gives you total flexibility in terms of design, styling and display.

Step 1

Copy paste the following code in your template, replace feedburner-id with your Feedbuner username. This script will grab you the feed count in numbers.


<?php
  //get cool feedburner count
  $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=rss4real";

//Initialize the Curl session
  $ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  //Set the URL
  curl_setopt($ch, CURLOPT_URL, $whaturl);
  //Execute the fetch
  $data = curl_exec($ch);
  //Close the connection
  curl_close($ch);

$xml = new SimpleXMLElement($data);
  $fb = $xml->feed->entry['circulation'];

//end get cool feedburner count
  ?>

Step 2

Paste this anywhere you want and it’ll display a feedburner subscriber count in text.

<?php echo $fb;?>

To style it nicely with your website or blog’s theme, add <p> or <div> and tweak the CSS accordingly.

via 45n5

Related Contents

Sponsors

Posted by hongkiat in Web Tricks, Wordpress Tips Tricks , at 07.01.08

Tags: , , ,

Comments

  1. rei July 1st, 2008

    hey..thats easy, thanks..u just gave me an idea how to fake the number..lol

    Reply
  2. hongkiat July 1st, 2008

    @rei Yeah but there’s really no point faking because it’s easy to find out if someone is faking it :-)

    Reply
  3. Johnson July 1st, 2008

    thank you very much for this beautiful piece of code as i was looking for this from a long time,

    just because i needed to use this for my new blog template…

    Reply
  4. rei July 1st, 2008

    no..i was just kidding, i always wonder how to get the feedburner stat..till i read it here, nice post

    Reply
  5. Danny July 1st, 2008

    Very useful tip man :)

    Reply
  6. Ramy July 1st, 2008

    Thanks.. Dugg. :)

    Reply
  7. Htoo Tay Zar July 1st, 2008

    Thanks a lot mate!! Now, I can design my feed counter text =) thanks

    Reply
  8. A Suresh Kumar July 1st, 2008

    Excellent Code, i am searching for integrating this concept in my blog. i will do it now.

    Reply
  9. Friendstermod July 1st, 2008

    Wow, I think I should use that code. But I still wonder how to do that at my other blog (blogger based)..

    Reply
  10. Lee July 3rd, 2008

    Nice information. :)

    Reply
  11. Juan Carlos July 8th, 2008

    thanks for the trick

    ;)

    Reply
  12. Rúben M. July 30th, 2008

    I am using this for about 2 weeks i use a simple style :) but i recommend this code, is awesome to use lol

    Reply
  13. Marco August 4th, 2008

    If your server doesn’t support CURL, you can also try to load the XML file created by Feedburner.

    To do so, please read the following article:
    http://www.marcofolio.net/webdesign/show_your_feedcount_the_way_you_want.html

    Keep on bloggin,,,

    Reply
  14. Tony August 5th, 2008

    I think there needs to be a note about caching the result. Feedburner stats update just once each day; and it’s really not a good idea to have to wait for an external page to be loaded and parsed, before any of your own pages even begin to render.

    Reply
  15. Fubiz August 8th, 2008

    Thanks for the tips.

    Reply
  16. Eudes August 12th, 2008

    Hey ! something is wrong !

    I am getting 1662 feed readers!! :)

    I don´t have that much.

    Have any one gone through this too??

    Am I missing something??

    Reply
  17. Eudes August 12th, 2008

    never mind, never mind…..just read

    http://code.google.com/apis/feedburner/awareness_api.html

    and you mentioned also “…replace feedburner-id with your feedburner username…”

    i need to me more patience and read more carefully :)

    Reply

Leave a reply