0

有人可以告诉我如何使用 php 将 feedburner 订阅者计为文本吗?我正在尝试以下操作,但它不起作用,因为我认为 feedburner 已经更改了 xml 文件的内容。谢谢你的帮助。

$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=USERNAME";
$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'];
echo $fb;
4

1 回答 1

0

需要将第 7 行更改为:

$fb = $xml->feed->entry->attributes()->circulation;

//很久以后编辑

实际上,到目前为止,我的博客上有几篇文章,其中包含用于获取 facebook/twitter/feedburner 计数的代码。带有 APC 缓存的代码在这里:http ://www.glowingminds.co.uk/facebook-likes-twitter-follows-and-feedburner-count-in-php-with-curlsimplexml-deluxe/

于 2012-02-28T15:55:03.330 回答