RSS(简易资讯聚合)是一种消息来源格式规范,用以发布经常更新资料的网站,例如部落格文章、新闻、音讯或视讯的网摘。
在使用feedburner来生成RSS Feeds时,考虑到页面布局的需要,我们需要自定义显示RSS Feeds订阅数。
1. 新建rss.php,代码如下:
<?php
//get feedburner count
$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=hvdesigns";
//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 feedburner count
2. 在需要显示RSS Feed数的页面需要包含(include)rss.php
<?php include("rss.php"); ?>
3. 显示订阅数的代码
<?php echo $fb;?>
除非注明,本博客文章均为原创,转载请以链接形式标明本文地址
原创文章如转载,请注明:转载自 任鸟飞网页设计 [ http://www.renniaofei.com/ ]
本文链接地址: http://www.renniaofei.com/code/displaying-rss-feeds-as-text/
引用通告地址 Trackback URL:直接在本文链接地址后添加 trackback/
本文短网址: http://bit.ly/9vcYeQ
原创文章如转载,请注明:转载自 任鸟飞网页设计 [ http://www.renniaofei.com/ ]
本文链接地址: http://www.renniaofei.com/code/displaying-rss-feeds-as-text/
引用通告地址 Trackback URL:直接在本文链接地址后添加 trackback/
本文短网址: http://bit.ly/9vcYeQ



