Tutorial: Display your Google Feedburner count on your Website
Get our posts emailed to you with our monthly newsletter, subscribe here.
Following on from my tutorial that shows you how to display your latest Tweet on your website, I will now show you how to show of your Feedburner subscribers count in plain text on your website. Feedburner does already give you the option to display your count on your site using their ‘chicklets’ but these are widget like icons that aren’t particularly customizable and for my site, they did not look right!
The advantage of been able to display your subscibers count in plain text is that you can customize it endlessly! You can even use jQuery to add the hover over ‘show count’ effect you often see on RSS icons. Needless to say, this way is much better then the Feedburner chicklets.
Right, first thing you need to do is use a bit of code to pull the count, and second you need to display it on your site. This first bit of code needs to be somewere near the top of your page, like your header…[php] <?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $temp);
$data = curl_exec($ch);
$xml = new SimpleXMLElement($data);
$feedcount = $xml->feed->entry[‘circulation’];
Don’t forget to change where it says FEEDBURNERID to the Feedburner ID relivant to your account. Now that you have the feed count in the variable $feedcount you are free to display it on your site, for example…[php] There are currently <?php echo $feedcount; ?> subscribers.
The script requires PHP5, so if you are encountering any errors, then it is likely your are running an older version of PHP, otherwise, you may have used an incorrect Feedburner ID. Also please note that this script is for Google Feedburner accounts. Google acquired Feedburner a while back so if you haven’t converted your Feedburner account into a Google one then you will need to do so before you use this script.