Wordpress

Solve the FeedBurner API Zero Subscriber Problem with Caching

feedburner api errorFeedburner returns zero subscribers? This can’t be true!

Well, you ‘re right, this isn’t true; probably due to high load, the FeedBurner web service returning the current RSS circulation (subscribers) response is zero. This seems to happen every day for 4-5 hours.

I decided to deal with this while solving the caching problem at the same time; the idea is simple: cache the FeedBurner circulation response if it is not 0, and always show the cached result.

So, in WordPress this would be placed on the functions.php of the theme:

Please note that the code above requires PHP to be compiled supporting cURL (libcurl) and SimpleXML (libxml). Moreover. if you get any problems using the SSL URI, you may try adding the following line to curl options:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

Or, if you have administrator rights on your host, refer to this article for a more permanent solution.

It’s quite easy to use this function: wherever in your theme files you would like the FeedBurner circulation to appear, you may call the get_feedburner_circulation()function, passing your FeedBurner ID as a parameter. Example:

<div>FeedBurner Subscribers: <?php echo get_feedburner_circulation('Moneytized'); ?></div>

Optionally, you may change the caching TTL to your preference, passing the desired value in seconds as a second parameter: e.g. <?php echo get_feedburner_circulation('Moneytized', 3600); ?> will cache the FeedBurner results only for one hour.

Of course, if you actually have 0 subscribers, the results may be peculiar, so you may need to manually confirm the FeedBurner response at the URL: https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=<YOUR-FEEDBURNER-ID>

Finally, even if someday FeedBurner corrects its API behaviour, using this function will still leave you with a caching implementation aiding the load of your server.

About the author

Nikolaos Anastopoulos

Nikos is an IT consultant providing professional services with broad experience on data analysis, data migration and web development. Being part of the Moneytized team, Nikos migrates his expertise on Information Technology with Internet marketing, resulting in high quality Internet implementations. More on his profile.

1 Comment

Leave a Reply to Vassilis X