欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php 獲取百度的熱詞數(shù)據(jù)的代碼

 更新時(shí)間:2012年02月18日 12:56:05   作者:  
php 獲取百度的熱詞數(shù)據(jù)的代碼,返回?cái)?shù)組
復(fù)制代碼 代碼如下:

<?php
/**
* 獲取百度的熱詞
* @user 小杰
* @from http://www.isharey.com/?p=354
* @return array 返回百度的熱詞數(shù)據(jù)(數(shù)組返回)
*/
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("&", "&amp;", $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;
}
print_r(getBaiduHotKeyWord());

相關(guān)文章

最新評(píng)論