FeedBurner Library for PHP and CodeIgniter

Introduction

This library provides a simple way to retrieve the number of subscribers of a FeedBurner account through the FeedBruner Awareness API in order to display a custom counter on your website. Besides, the class provides a file based caching system since an extra HTTP request is required to get the FeedBurner account data.

The library is available for native PHP applications and also as a library for the CodeIgniter framework.

Please note that this class requires PHP 5.1.0 with SimpleXML and libxml and the cURL extension.

Finally, thanks to Dev Words for the original tutorial.

Setting-up the library

In order to deal with your FeedBurner account, the library can be configured by five parameters:

  • $username: this is the url key of your FeedBurner URL feed (not your account username!), for example, mine is « Nukium » (http://feeds2.feedburner.com/Nukium)
  • $cache: TRUE / FALSE for enabling / disabling the caching system (note that enabling cache is more than five times faster !)
  • $path: if cache is enabled, this should contain the path to the directory where the caching file will be stored, please ensure that your path ending with a trailing slash!
  • $filename: this is the name of the caching file if you want to change it (default: feedburner.xml).
  • $ttl: e.g. Time To Live, this is the time in minutes that the caching file is stored before being refreshed (default: 60 minutes).

How to use the library inside a PHP native application

For a native PHP application, the library comes as a classic PHP class. Example below shows how to load the class (with caching enabled) and how to retrieve the number of subscribers (we are just printing it by the way).

How to use the library inside a CodeIgniter application

For a CodeIgniter application, the class comes as a library. You can either load the library with a $config array or use the initialize(array $config) function to set up parameters. The library has been tested with CodeIgniter 1.7.1 only.

License

The library is licensed under the GNU Lesser General Public License, if you use it feel free to add a credit anchor to this page on your website.

Download

Click here to download the FeedBurner library package.

FAQ

  • If a path related error occurs when enabling cache, please ensure to add the final trailing slash to $path (e.g. ./folder/sub-folder/final-folder/).
  • Some users on WAMP could experiment a problem with cURL in local. First try your application online to check if your code works on a production server.
  • If no error occurs but it simply doesn’t work, ensure your API access isn’t disabled in your Google FeedBurner account.

Feedback and Support

Feel free to give your feedback or your feature request by leaving a comment on this page.
Support and feedback are both available in English and in French.

Cette entrée a été publiée dans CodeIgniter le par Team Nukium.

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *