La siguiente función nos muestra la media de suscriptores a Feedburner dada una URL y un intervalo de tiempo. Si no se fija un intervalo nos mostrará la media de los últimos 7 días. La función utiliza CURL.
<?php
function suscriptores_feedburner($feed_id,$intervalo = 7){
$hoy = date('Y-m-d', strtotime("now"));
$hasta = date('Y-m-d', strtotime("-".$intervalo." days"));
$feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$hasta.",".$hoy;
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $feed_url);
$datos = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($datos);
$feedburner = $xml->feed->entry['circulation'];
$nb = 0;
foreach($xml->feed->children() as $circulacion){
$nb += $circulacion['circulation'];
}
return round($nb/$intervalo);
}
//Ejemplo de uso
echo suscriptores_feedburner("http://feeds.feedburner.com/webintenta/WVpB",$intervalo = 7);
?>




