How To Get Your Feedburner Subscriber Count Using PHP

Feedburner is an awesome service for web sites that publishes RSS feeds. One area it’s particularly good at is at collecting and presenting statistics about your feeds.

If you use Feedburner, you probably have the Feedburner chicklet displaying the number of subscribers to your feed. It looks something like this:

Have you ever wanted to get the number of subscribers in plain old text to be used in your web pages? If you want to know how to do this in PHP, continue reading.

First off, this guide is for PHP5 only. So PHP4 users, you’re out of luck… if I’m a little less lazy, I’d probably write one for you guys as well.

To extract the subscriber count from your Feedburner feed, we’ll use the Feedburner Awareness API. What’s this Awareness API? Well, according to Feedburner;

The FeedBurner Awareness API (AwAPI) allows publishers of FeedBurner feeds to reuse the detailed traffic statistics we capture for any of their feeds. Third-party applications and web services that consume feeds can leverage this data to provide useful feed awareness statistics to potential subscribers.

To retrieve the data for our feed, we need to know the Feedburner URL of the feed. For HTNet, this is http://feeds.feedburner.com/htnet. With this information, we can already retrieve the subscriber count by using the AwAPI. Just take a look at the following XML file: HTNet’s AwAPI data.

Also note that you can just use the Feedburner ID for the feed for use in the AwAPI as well. The Feedburner ID is this bolded bit in your Feedburner URL http://feeds.feedburner.com/htnet. This means that the following URL will also produce HTNet’s AwAPI data as well: http://api.feedburner.com/awareness/1.0/GetFeedData?uri=htnet.

If you compare the number of subscribers from the XML file with the number displayed in the Feedburner chicklet, you might notice a slight difference. The most likely reason for this is that the chicklet is cached to reduce load time, therefore it it’s showing a “remembered” figure and might not be 100% accurate.

Now, we just need a PHP script to extract the feed subscriber number from our XML data. Using PHP5, the most logical choice to do this would of course be via simplexml_load_file.

Rather than say how easy it is to do, why not I just demonstrate it: retrieving Feedburner subscriber count via PHP. You can download the PHP script here (just rename it to have a .php extension and upload to your server).

Using the AwAPI, you’re no longer tied to using Feedburner’s chicklets to display your subscriber count. You’ll also get the most accurate subscriber figures. With some fidling, you can integrate this function in your blogs, or other Feedburner-powered web sites. A working example is at the top section of my sidebar; you can see that I’ve included the number of current subscribers in my feed links’ header.

If you like this article, please increase my Feedburner counter by subscribing to HTNet’s feed :) You can also bookmark, or share this post with your friends using the Share This button below.

4 responses to “How To Get Your Feedburner Subscriber Count Using PHP”.

  1. cwkhang Says:

    can also use http://feeds.feedburner.com/~fc/username

    http://feeds.feedburner.com/~fc/htnet

  2. Sameer Says:

    Hi,
    I want to know about how to get RSS feedburner count value.

  3. New Theme Lab Design by James McDonald | Theme Lab Says:

    [...] Text display of FeedBurner subscriber count thanks to this code [...]

  4. Wordpress Blog Services - New Theme Lab Design by James McDonald Says:

    [...] Text display of FeedBurner subscriber count thanks to this code [...]