How To Display Your Feedburner Count And Twitter Followers Without Chicklets

Feedburner offers a great chicklet which allows you to add your subscriber count to your site, and for Twitter you can use a chicklet to display your followers from a service such as twittercounter.com.
What I’m going to show you today is a method of displaying these counts without actually using a chicklet which will allow you to customise how your stats will be displayed.
We will be using PHP to grab the data you need, then you can style with CSS within your own site, Please backup any files before editing them!
FeedBurner
This following code grabs the data from feedburner using the awareness API, replace “YOUR FEED ADDRESS” with your feedburner feed address, e.g. WebM-ag
<?php
$url = file_get_contents('https://feedburner.google.com/api/awareness/1.0/Get
FeedData?uri=YOUR FEED ADDRESS');
$begin = 'circulation="'; $end = '"';
$page = $url;
$parts = explode($begin,$page);
$page = $parts[1];
$parts = explode($end,$page);
$fbcount = $parts[0];
if($fbcount == '') { $fbcount = '0'; }
echo '<b> '.$fbcount.' </b> Subscribers';
?>This will echo out the count, e.g. 399 Subscribers.
This code uses the Twitter API and grabs its count from a XML feed, replace “USERNAME” with your Twitter username, e.g. webmagz
<?php
$twit = file_get_contents('http://twitter.com/users/show/USERNAME.xml');
$begin = '<followers_count>'; $end = '</followers_count>';
$page = $twit;
$parts = explode($begin,$page);
$page = $parts[1];
$parts = explode($end,$page);
$tcount = $parts[0];
if($tcount == '') { $tcount = '0'; }
echo '<b> '.$tcount.' </b> Followers';
?>This will echo out your follower count, e.g. 712 Followers
All Done
That’s pretty much the bare bones code you need to get started, you can of course style it in any way you wish, as it uses PHP your page extension MUST be .php (not .html etc…) or within WordPress it will work without altering any page extensions.
Demo
Here is a very basic styled demo which is available to download in a .ZIP file
DEMO | DOWNLOAD
16 Comments
Trackbacks
- How To Display Your Feedburner Count And Twitter Followers Without Chicklets | Web Design Updates
- tripwire magazine | tripwire magazine
- 135+ Fresh Community Posts for Designers and Developers | tripwire magazine
- 135+ Fresh Community Posts for Designers and Developers | Afif Fattouh - Web Specialist
- CSS Brigit | How To Display Your Feedburner Count And Twitter Followers Without Chicklets
- 10 wordpress hacks & tricks that I like at The MegaMag
- How To Display Total FeedBurner Reader in Text # WordPress Tricks & Tips
- How To Display Twitter counter in Text # WordPress Tricks & Tips



February 5, 2010
Great work explained thanks for sharing.
February 8, 2010
I will use this on my homepage, thanks for share…
February 8, 2010
Without caching? See http://wordpress.org/extend/plugins/bitly-retweet/ with internal cache for more blog performance.
February 8, 2010
Hi Sergei,
Yeah I left out caching, I aimed to keep it basic so the code could be expanded on, perhaps databased and run on a cron if needed
February 10, 2010
Thanks! It works like a charm.
February 11, 2010
For some reason when entering the Feedburner script, I cannot use the HTTPS formatting, as it returns not only the actual result but an error string also. I can’t figure it out – I remove the “S” from the http and it works fine, but it won’t work for me (in WordPress) with HTTPS.
Have I done something wrong with it, or am I right to use it without the HTTPS? (Sorry, PHP n00b here)
February 11, 2010
Hi Laneth, you can use it without HTTPS and the result is the same, the demo is running on HTTPS and works fine.
I would suspect there might be something on your hosting/server preventing the https working correctly. (or maybe in your WP .htaccess?)
Here is a demo without https: http://www.webm.ag/tuts/fbtwit/tut1.php
February 11, 2010
Hey McBonio, thanks for the response. When I learn a bit more about this sort of thing, I’ll know just what to do
Thanks for your help!