FeedBurner subscription show-off revisited

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); 
curl_close($ch);		
if ($data) {
	preg_match('/circulation=\"([0-9]+)\"/',$data, $matches);
	if ($matches[1] != 0)
		$fb['count'] = $matches[1];
	$fb['lastcheck'] = mktime();
	update_option("feedburnersubscribecount",$fb);
}
echo $fb['count'].' Subscribers can\'t be wrong! Subscribe by <a href="http://yoast.com/email-blog-updates/">email</a> or to the <a rel="nofollow" href="http://feeds.feedburner.com/joostdevalk">RSS feed</a> now!';

Enjoy!

18 Responses to “FeedBurner subscription show-off revisited”

  1. 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?

  2. 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.

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

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

    Thanks!

  5. 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.

    Thanks!

  6. 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..

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

  8. 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?

  9. Let's me test the new one ;)

  10. Works great. Can you write about caching the queries?

  11. 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!!

    http://www.theanand.com/blog/index.php/just-ripples/display-feedburner-subscriber-count/

  12. 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

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

Comments closed, if you feel you have something to say:
drop me a line.

4 Trackbacks to “FeedBurner subscription show-off revisited”

  1. Display Feedburner Subscriber Count | TheAnand - Mon, June 29th, 2009 at 12:47