经测试代码如下:
/**
* 获取Feedburner的用户名
*
* @param
* @author 编程之家 jb51.cc jb51.cc
**/
function get_average_readers($Feed_id,$interval = 7){
$today = date('Y-m-d',strtotime("now"));
$ago = date('Y-m-d',strtotime("-".$interval." days"));
$Feed_url="https://Feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$Feed_id."&dates=".$ago.",".$today;
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_URL,$Feed_url);
$data = curl_exec($ch);
curl_close($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);
}
/*** 代码来自编程之家 jb51.cc(jb51.cc) ***/