php 获取百度的热词数据
span style=font-family:monospace;font-size:small;span style=line-height:normal;white-space:pre;获取百度的热词数据/span/span br / div div div class=translate/div div class=additional/div /div img src=http://www.google.com/uds/css/sma
获取百度的热词数据


/** * 获取百度的热词 * @user 小杰 * @from http://www.isharey.com/?p=354 * @return array 返回百度的热词数据(数组返回) */ function getBaiduHotKeyWord() { $templateRss = file_get_contents('http://top.baidu.com/rss_xml.php?p=top10'); If (preg_match('/<table>(.*)<\/table>/is', $templateRss, $_description)) { $templateRss = $_description [0]; $templateRss = str_replace("&", "&", $templateRss); } $templateRss = "<?xml version=\"1.0\" encoding=\"GBK\"?>" . $templateRss; $xml = simplexml_load_String($templateRss); foreach ($xml->tbody->tr as $temp) { if (!empty ($temp->td->a)) { $keyArray [] = trim(($temp->td->a)); } } return $keyArray; }
- 上一篇:PHP 二维数组分页处理
- 下一篇:MyNews 调用栏目信息(缓存方式)
精彩图集
精彩文章