PHP subscriber counter with Addicted to Feedburner class and Feedburner Awareness API
Sunday 29th June 2008

A FeedBurner subscriber counter with change indication using the Addicted to FeedBurner API PHP class and FeedBurner Awareness API.

This function enables you to display your FeedBurner subscriber count in your own style/design without using the FeedBurner subscriber counter image. The function enables you to optionally display a 'change indicator' showing the percentage change in subscribers since yesterday (since FeedBurner data is not live, this is in fact two days ago). If their have been new subscribers the change will be positive and a green arrow will be shown indicating as such, if their has been a decrease in the number of subscribers a red arrow will be shown.
Our PHP function is based on the Addicted to FeedBurner API PHP class which was written by John Nunemaker, and the FeedBurner Awareness API provided by FeedBurner.
Usage

After setting the stylesheets as per the example file (see 'Configuration' instructions below), simply use the following to display the FeedBurner subscriber counter:
require "feedburner_subscribers.php";
print feedburner_stats("FeedBurner-Username");
To include the change indicator:
require "feedburner_subscribers.php";
print feedburner_stats("FeedBurner-Username", 1);
The two input flags are used as outlined below:
feedburner_stats(FEEDBURNER USERNAME, ENABLE CHANGE INDICATOR);
- FEEDBURNER USERNAME

The name of your FeedBurner account/feed.

- ENABLE CHANGE INDICATOR

Display change indicator next to subscriber count, set to '1' to enable, leave blank or set to '0' to disable.
Configuration

The example.php file contains various JavaScript and CSS/Stylesheets which must be included before loading the subscriber counter, this is not required but adds additional functionality (such as the mouseover new subscriber count) and styles the output. Feel free to remove the CSS and references within the function.
Error Messages

Error: (1) Feed Not Found
Solution: Your FeedBurner username/feed name is invalid.
Error: (2) This feed does not permit Awareness API access
Solution: You have not enabled the Awareness API - login to your FeedBurner account and go to 'My Feeds', select the appropriate feed (if you have multiple) and select the 'Publicize' option in the top menu, then select the 'Awareness API' link in the sub-menu on the left, from here simply select 'Activate' and 'Save'.
Further information regarding these error messages and other can be found in the, FeedBurner Awareness API Documentation.
License and Download

This code is Open Source and is released under the GNU General Public License.
We hope you find this code of use, if you use it in your projects we'd love to hear about it! And of course, if you have any questions please don't hesitate to post a comment and we will respond as soon as possible.
Syntax highlighting powered by JUSH
Share this article:
|
<- AJAX Tree Menu with PHP
|
Login form designs and inspiration ->
|
|