How To Display FeedBurner Subscribers Count using PHP


You might have seen several blogs and websites showing off their Subscribers count from FeedBurner and you must be wondering how to do the same on your blog. Well, Here’s how :

1. First you need to activate the FeedCount Service on your FeedBurner account.  You can do this by logging in to your Feedburner account (http://feedburner.google.com/) and then clicking on the name of the Feed for which you need the count to be displayed.

2. Next, goto Publicize -> FeedCount -> Activate (If you haven’t already activated it).

Next, we need to get the count from the FeedBurner Awareness API (https://developers.google.com/feedburner/awareness_api) to display it on our blog :

1. Open your code editor for your page and copy this code onto it :

This code will number of subscribers your feed has got and output it as HTML to your page.

<?php 
//Define the URL
$FeedBurnerURL="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=YOURFEEDBURNERID";  
//Initiate a Curl session 
$curlsess = curl_init();    
//Set curl not to print the data which is received 
curl_setopt($curlsess, CURLOPT_RETURNTRANSFER, 1);  
//Set the URL 
curl_setopt($curlsess, CURLOPT_URL, $FeedBurnerURL); 
//Execute the CURL session 
$returnedData = curl_exec($curlsess); 
//Close the connection 
curl_close($curlsess);
//Parse the XML Output and get the value from the circulation attribute
$xml = new SimpleXMLElement($returnedData);
$count = $xml->feed->entry['circulation']; 
// Print the FeedBurner Count
echo $count . " subscribers";
?>

The Embed Code Way :

You can display static or animated boxes (called as chicklets) to show your subscribers count by embedding the code from the FeedCount Page from your Feedburner Page which may look like this :

<p><a href="http://feeds.feedburner.com/TechTwinklers"><img src="http://feeds.feedburner.com/~fc/TechTwinklers?bg=99CCFF&amp;fg=444444&amp;anim=0" height="26" width="88" style="border:0" alt="" /></a></p>

 

ElamParithi Arul is Editor At Large and the Owner of Tech Twinklers. He is the founder of the Parithi Network. Basically being a 23 year old Whizkid, He's A Mac User. An Adventurer. A Tech Enthusiast, An Avid PC and PlayStation Gamer, A Hobbyist Photographer and a Nature Lover. His basic interests are developing Websites, Apps and coming up with various creative ideas for a better vibrant tomorrow. He is a professional blogger for about 4 years and writes blogs regarding technology, gaming, and about his own personal life. You can follow him on Twitter at @Parithi

You may also like

LEAVE A COMMENT

Welcome To TechTwinklers!

Tech Twinklers is a Tech Blog run by Students with an aspiring enthusiasm in Technology and Gaming. This Blog will bring News about the Modern Technology, Educational Advances, Campus Interviews, etc. So make sure you subscribe to our blog because we don't want you to miss a thing that is posted here..

We're on Facebook!