Display subscriber count for FeedBurner feeds hosted by Google

If you’re using FeedBurner to manage and publicize your RSS feeds, you might already know WordPress plugins like FeedCount, that help you get the number of your feed’s subscribers – btw, I’m assuming you too can’t stand the ugly FeedBurner default widget.

While this used to work as a charm, you also might have heard FeedBurner has been aquired by Google and it’s moving feed to Google’s server. Unfortunately the above plugin stops working for feeds hosted by Google.

My friend Stefanos (aka Titanas) recently sent me this piece of code, that easily solves this issue.
It will display the number of your subscribers, like this.

<?php
function get_subscriptors($feedburneruri) {
         $url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feedburneruri;
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_URL, $url);
         $data = curl_exec($ch); curl_close($ch);
         $xml = new SimpleXMLElement($data);
         return $xml->feed->entry['circulation'];
}
?>
Jek2k.com has <?php echo get_subscriptors('jek2kdotcom'); ?> subscribers.

About this entry