Php 获取feedburner订户的数量?

Php 获取feedburner订户的数量?,php,curl,feedburner,Php,Curl,Feedburner,我目前正在使用此代码获取我的博客的订户数: $whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=http://feeds.feedburner.com/DesignDeluge"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $whaturl); $data = curl_

我目前正在使用此代码获取我的博客的订户数:

$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=http://feeds.feedburner.com/DesignDeluge"; 
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $whaturl);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data); 
$fb = $xml->feed->entry['circulation'];

但是,当我回显$fb时,它不起作用(回显$fb的整个文件不会出现)。关于为什么这不起作用有什么想法吗?

如果您在尝试使用SimpleXMLElement加载它之前查看一下
$data
,您会看到它包含以下HTML代码部分:

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://feedburner.google.com/awareness/1.0/GetFeedData?uri=http://feeds.feedburner.com/DesignDeluge">here</A>.
</BODY></HTML>
我只得到以下XML作为返回:

<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
    <err code="2" msg="This feed does not permit Awareness API access" />
</rsp>



你确定你使用的URL/feed是正确的吗?

啊,事实证明有两件事是错误的:我所遵循的教程已经过时,所以URL是错误的,我还必须自己启用对API的访问。谢谢不客气:-)很高兴你发现了问题的原因:-)
<?xml version="1.0" encoding="utf-8" ?>
<rsp stat="fail">
    <err code="2" msg="This feed does not permit Awareness API access" />
</rsp>