UPDATE (01/12/2013): This will no longer work because Google has shutdown FeedBurner API.
FeedBurner is a web feed management provider from Google. It provides custom RSS feeds and management tools to bloggers, podcasters, and other web-based content publishers. Recently, I wrote posts on how to get Facebook like count using PHP and Twitter followers count. Continuing along the same lines, in this post, I will explain how to get FeedBurner subscribers count using a simple PHP script. The number can be stored in cache or a database and displayed as simple formatted text or combined with other numbers to display a total followers/subscribers count thereby saving some much need sidebar-space. It also slightly improves page load speeds. So without further delay, here it goes.
PHP code to get FeedBurner Subscribers Count
The PHP script to get FeedBurner Subscribers count is pretty simple and straightforward:
$fburl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=http://feeds.feedburner.com/htpcBeginner"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $fburl); $stored = curl_exec($ch); curl_close($ch); $grid = new SimpleXMLElement($stored); $rsscount = $grid->feed->entry['circulation'];
$fburl is the variable to hold the link to access your FeedBurner API. Only edit you have to do is replace
htpcBeginner with your account name. You can get it from your FeedBurner page:
After you get FeedBurner subscribers count, you can display it as simple text using the following PHP code:
echo $rsscount.' subscribers';
This will output
FeedBurner Subscribers Count History
Although you may be able to get FeedBurner subscribers count history and more by other means, I like to record the data in a format I like. I currently get Facebook like count, Twitter followers count, FeedBurner subscribers count, and Alexa site rank and record them in a MySQL database daily to see the growth of my blog. If you make any changes / improvements to your blog then you have the data to see what impact it had on your subscribers / followers count. In a separate post, I will explain how to accomplish this.
Meanwhile, get FeedBurner subscribers count using the above script, get creative, and find innovative ways to use the count. Please do not forget to share your idea with us in the comments sections.