PHP – Get your average Feedburner subscribers

Recently, Feedburner counts had lots of problems and it’s hard to say that the provided info is still relevant.

This code will grab your subscriber count from the last 7 days and will return the average.

function get_average_readers($feed_id,$interval = 7){
$today = date('Y-m-d', strtotime("now"));
$ago = date('Y-m-d', strtotime("-".$interval." days"));
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
url_setopt($ch, CURLOPT_URL, $feed_url);
$data = curl_exec($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];

$nb = 0;
foreach($xml->feed->children() as $circ){
$nb += $circ['circulation'];

return round($nb/$interval);

Leave a Reply

Your email address will not be published. Required fields are marked *