Browse By

How To Get Your FeedBurner Circulation With One Simple Function

If you have visited a few blogs then I am sure you have seen the FeedBurner stats graphic. The count is very useful, but the graphic itself isn’t very appealing, even with the ability to customize it. Thankfully the FeedBurner API was released, which allows you to retrieve your stats without the graphic. I have taken that API and created a simple function, with the help of simple XML, to grab your circulation count and display it as text on your site without the graphic.

To start off, you will need to download the simple XML class and put it in the same folder as the file that will contain this function (or change the include path to reflect the directory of your choice). Once you have done that, you are pretty much done. All you need to do is copy the function below and call the function with your feed URI and it will return the circulation number.

You can see the function and sample usage below.

Function

function FeedBurnerCirc($feed) {
include 'simplexml.class.php';
$api = 'http://api.feedburner.com/awareness/1.0/GetFeedData?uri='.$feed;
$sxml = new simplexml;
$sxml->ignore_level = 1;
$data = $sxml->xml_load_file($api,"array");
return $data["entry"]["@attributes"]["circulation"];
}

Usage

echo FeedBurnerCirc('http://feeds.feedburner.com/webmastersbydesign');

You could also easily customize the function to include more data and return an array of results. The API returns data other that the circulation, such as your reach and views. I only wanted the circulation so I didn’t return an array of results, but it wouldn’t be tough to do.



One thought on “How To Get Your FeedBurner Circulation With One Simple Function”

Comments are closed.