FeedBurner subscription show-off revisited

December 21st, 2008 – 22 Comments

A couple of months back I blogged about how to show off your FeedBurner subscribers. In the comments then, a couple of people told me the code didn’t work for them. After a few back and forths I found out those people were on FeedBurner’s new servers, the Google ones.

This new server actually has a new API Endpoint as well, and this endpoint brings along a bit of trouble. Google in all its wisdom decided to move the API onto HTTPS. Problem is, I was using Snoopy, which rocks, but doesn’t work with HTTPS easily. It needs CURL for that, and if it needs CURL anyway, why not use the built-in PHP CURL. So, here’s the code to use when you’re on feedproxy (if this doesn’t work for you, try the above linked older code):

$url	= 'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=joostdevalk';
$ch 	= curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch); 
if ($data) {
	preg_match('/circulation='([0-9]+)'/',$data, $matches);
	if ($matches[1] != 0)
		$fb['count'] = $matches[1];
	$fb['lastcheck'] = mktime();
echo $fb['count'].' Subscribers can't be wrong! Subscribe by <a href='https://yoast.com/email-blog-updates/'>email</a> or to the <a rel='nofollow' href='http://feeds.feedburner.com/joostdevalk'>RSS feed</a> now!';


22 Responses to FeedBurner subscription show-off revisited

  1. Jerome
    By Jerome on 14 March, 2009

    Can’t get to work. Nothing displays, I tried both code.

  2. SDK
    By SDK on 11 March, 2009

    this stopped working for me all of the sudden – nothing displays
    i reverted back to the old show off code, it works, but shows an incorrect subscriber count

  3. TheAnand
    By TheAnand on 30 December, 2008

    This same code with the cache implemented is in my blog in case anyone is looking for a easy copy paste of this method code!!


  4. Ajay
    By Ajay on 30 December, 2008

    Works great. Can you write about caching the queries?

  5. Jauhari
    By Jauhari on 30 December, 2008

    Let’s me test the new one ;)

  6. Nihar
    By Nihar on 25 December, 2008

    My subscribers shows 900 odd. but when i open this https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=ThinkersOnMove link in browser. It shows circulation=”0″ . Any reason why?

  7. Nihar
    By Nihar on 25 December, 2008

    Joost, thanks for this tiny curl script. I will use this to show off the subscription.

  8. Andrew Mason
    By Andrew Mason on 23 December, 2008

    I spoke too soon.

    All worked fine, then it just stopped? Now, $fb[‘count’} has a null value. The strange thing is that it worked fine for 15 minutes..

    • Joost de Valk
      By Joost de Valk on 23 December, 2008

      Check out my previous post and steal the caching I used there :)

      • Jesh Barlow
        By Jesh Barlow on 3 April, 2009

        Sorry, designer here, not a developer. I’m a bit worried that I’ll have Andrew’s same problem, but I have no clue how to paste in the caching from the previous link. Did you already update the above code to include the same caching as the previous solution, or do I need to somehow use the mktime() < 600 line? I’m just totally ignorant of the syntax.

        Thanks for your help!

      • Andrew Mason
        By Andrew Mason on 23 December, 2008

        I cut the caching code and all works fine.

        Thanks, this looks great again on my blog!

        Have a great Christmas!

      • Andrew Mason
        By Andrew Mason on 23 December, 2008


        Just trying that now.

  9. Andrew Mason
    By Andrew Mason on 23 December, 2008

    Got it working great at http://www.didigetthingsdone.com.

    Thanks for the help. I did need to add an extra opening bracket after the second if statement but apart from this, it all works a treat and looks nice again on my blog.


  10. TheAnand
    By TheAnand on 23 December, 2008

    You have a extra closing bracket on the second last line…..otherwise…it works great!!!


  11. Andrew Mason
    By Andrew Mason on 22 December, 2008

    I have been having this issue since moving to Feedproxy so I will try to get it working on my blog. Thanks Joost!

  12. Seb
    By Seb on 22 December, 2008

    The original feeburner display counter you posted, 3 times it failed to load the api and diplayed a bunch of errors before the rest of my blog had loaded. Is this because of the new servers and connetion took a bit longer than it should have? I will try your new code, but so far I have had no problems again but I don’t want any more loading problems so if it comes up again I will post again with the reason the code did not load.

  13. slobjones
    By slobjones on 21 December, 2008

    Funny you should be promoting FeedBurner.

    I started using your Sociable plugin after FeedBurner abandoned support for its FeedFlare script. Didn’t bother to tell anybody — just abandoned it.

    You sure you want to help these guys?

Check out our must read articles about Analytics