Papermashup

Subscribe


Tweets


"RT @kycutwilson: @ashleyford @burgerbeartom incredible. There's 5 more left! Shout about it!!"

@ashleyford 2 days ago

"@burgerbeartom @kycutwilson finally got around to using my free burgers for life! And we weren't disappointed. http://t.co/nJ6p2nLtg4"

@ashleyford 1 week ago

Designer and web developer, Co-founder and Technical Director at Harkable.com. Previously I worked at Spotify, MySpace and InMobi. Contact me - ashley[at]papermashup.com

Display your Feedburner stats

AshleyAshley

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 '.$subscribers.' subscribers';

//close connection
curl_close($ch);

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

demodownload

Designer and web developer, Co-founder and Technical Director at Harkable.com. Previously I worked at Spotify, MySpace and InMobi. Contact me - ashley[at]papermashup.com

Comments 5
  • Rosell
    Posted on

    Rosell Rosell

    Reply Author

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


    • Ashley
      Posted on

      Ashley Ashley

      Reply Author

      Hi Rosell,

      Really appreciate the comments and thanks for the support :)

      Ashley


  • Scott
    Posted on

    Scott Scott

    Reply Author

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


  • Ben
    Posted on

    Ben Ben

    Reply Author

    It doesn’t work 😐


    • Ashley
      Posted on

      Ashley Ashley

      Reply Author

      @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‘);