Skip to content

Tips:用字符方式显示Feedburner订阅数

FeedBurner被封已经有很长一段时间,不过最近听说Google 将把Feedburner合并到Google帐户中,这对于许多Blogger来说,是很期待的一件事情,我同样也希望能尽早合并。

但在合并之前,有什么方能把Feedburner上的订阅数显示在自已的Blog上呢?其实我看到过很多朋友在想方设法这么干,不过这篇文章为我们提供了一种更简单实用的方法,那就是通过FB的API获取统计数据,同时以字符方式显示于Blog上。

方法如下:

步骤一

复制下面的代码到模版中,记得把FeedBurner ID替换为自已的ID,也就是”uri=fbid “中的 fbid。

<?php
//get cool feedburner count
$whaturl=http://api.feedburner.com/awareness/1.0/GetFeedData?uri=fbid;

//Initialize the Curl session
$ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);
//Execute the fetch
$data = curl_exec($ch);
//Close the connection
curl_close($ch);

$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];

//end get cool feedburner count
?>

步骤二 在你要输出统计数据的地方,在模版中添加如下代码。

<?php echo $fb;?>

另外,刚听说Feedburner官方还推出了一个Feed代理功能,地址是这样的:

http://feedproxy.feedburner.com/theskyofdaemon

如何?可以正常访问Feed吧?那么干脆把该链接也加上吧,我就是这样做的。

Technorati :

Related Posts with Thumbnails

3 Comments

  1. nobug wrote:

    Feedburner和feedsky一起用好像有些问题,懒得查怎么解决于是就用了feedsky……

    回复回复
    星期二, 七月 8, 2008 at 8:09 下午 | Permalink
  2. 抽筋儿 wrote:

    Great Tips !

    回复回复
    星期二, 七月 8, 2008 at 8:45 下午 | Permalink
  3. 还行,可参考。。

    回复回复
    星期三, 七月 9, 2008 at 6:13 下午 | Permalink

One Trackback/Pingback

  1. Tips:利用Technorati API在你的Blog显示排名 | Riku on 星期五, 十二月 5, 2008 at 11:28 上午

    [...] Yoast的Blog上介绍了一个利用Technorati API直接在Blog上显示排名的方法,原文为Using the Technorati API on your blog,此方法与之前介绍过的用字符方式显示Feedburner订阅数的方法类似,同样利用一段代码就可搞定。 [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*