Use your left/right keys to browse tutorials
Display your Feedburner stats

Display your Feedburner stats

1 Star2 Stars3 Stars4 Stars5 Stars
Posted on March 20, 2009

I’ve been away for the last week. My wife and I bought a flat in North London and finally moved in on March 16th. So I’m currently without the internet and won’t have it until the end of March which is frustrating when I want to update my blog but simply can’t so please excuse my infrequent posts over the next few weeks.

Here’s a quick piece of code to simply display your feedburner stats on your blog. I’m yet to post my stats publicly on my blog but have seen numerous blogs with the standard feedburner badge which I think is quite ugly. So here’s how to just get the stats using PHP and CURL. You can then style it how you like.

$ch = curl_init();
//set the feed url and options plus a timeout value
$timeout=5;
curl_setopt($ch,CURLOPT_URL,'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=AshleyFord-Papermashupcom');
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);  
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$result = curl_exec($ch);
// get just the subscriber number using the regex function
$subscribers = get_match('/circulation="(.*)"/isU',$result);

echo 'Papermashup.com has <strong>'.$subscribers.'</strong> subscribers';

//close connection
curl_close($ch);

function get_match($regex,$result)
{
	preg_match($regex,$result,$matches);
	return $matches[1];
}

demodownload



More tutorials from Papermashup
Comments
5 discussions around Display your Feedburner stats
  1. Rosell says:

    I think that the work you do here Ashley its GREAT! I love and please keep doing what are doing.

  2. Scott says:

    I tried it as well with my own uri, but it didn’t work with my own. It worked with yours though.

  3. Ben says:

    It doesn’t work :|

    • Ashley says:

      @ben do you get an error message? The demo code is exactly the same as the code above. You need to make sure that you just add your ‘URI’ which is the highlighted section: url http://feeds2.feedburner.com/AshleyFord-Papermashupcom

      So in the PHP code you need to just change the highlighted code below. Don’t simply paste your feedburner URL as it wont work.

      curl_setopt($ch,CURLOPT_URL,’https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=AshleyFord-Papermashupcom‘);





Never miss an update from Papermashup

Get notified about the latest tutorials and downloads.

Subscribe by Email

Get alerts directly into your inbox after each post and stay updated.
Subscribe
OR

Subscribe by RSS

Add our RSS to your feedreader to get regular updates from us.
Subscribe

Get in contact

Please use the form below to get in contact. If your question is related to a free script download, please use the comments on the article page as community members are more likely to respond quicker than I can personally.

About Me

I'm Ashley Ford, Co-founder and Technical Director at Harkable.com London, UK. Previously I worked at InMobi, Spotify and MySpace. My interests include photography and making short videos I'm also an avid F1 fan. I'm always working on side projects. Here are a few: Easy Poll, We Deliver.



What do you specialise in?

I spend a lot of time coding in PHP and MySQL, as well as front end XHTML and CSS. I also specialise in javascript and the jQuery framework as well as being an avid designer. You can find me on dribbble

Interested in advertising?

If you'd like to advertise on Papermashup.com please get in touch via the contact link below for advertising opportunities.

How do I contact you

You can contact me here. and I'm available for consultation, freelance, programming book reviews.

Get on the mailing list

Join over 3000 people who have subscribed to the Papermashup inbox message, and be the first to find out about tutorial, competitions and giveaways.