Plain Text Feedburner Subscriber Count
This is a short tutorial explaining how to get the raw number of subscribers from your Feedburner feed to display on your web page.
Intoduction
To do this simple trick we are going to use three things:
- Feedburner Awareness API (which you don’t need to activate for this)
- cURL (should be enabled on most servers)
- PHP 5 (to read the XML we need a PHP5+ function)
I’m assuming here you have a Feedburner account with an active feed.
The PHP
So onto the php.
<?php $feeduri = "progtuts"; //The bit that comes after http://feeds.feedburner.com/ $url = "http://api.feedburner.com/awareness/1.0/GetFeedData?uri=". $feeduri; $ch = curl_init(); //Use cURL curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Return data rather then echo it curl_setopt($ch, CURLOPT_URL, $url); //Pass in our url $data = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($data); //Read the returned XML $count = $xml->feed->entry['circulation']; //Get our subscriber count ?>
Thats it. Very simple. All we are doing here is using cURL to retrieve the XML output by the Feedburner API and convert it into a php variable. You can now use $count however you want.
Conclusion
To see an example of this view the demo below. I hope you find this little trick useful.
Related Posts
More?
If you enjoyed this post, please consider promoting it. Remeber to subscribe to the feed and get future articles delivered to your feed reader. If you want to discuss this tutorial or any other thoughts you have then you can do so over on our fourm.Comments
No comments yet...









