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("&", "&", $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());
您可能感興趣的文章:
- PHP生成sitemap.xml地圖函數(shù)
- php使用百度ping服務(wù)代碼實(shí)例
- php實(shí)現(xiàn)的百度搜索某地天氣的小偷代碼
- php使用百度天氣接口示例
- php實(shí)現(xiàn)批量下載百度云盤文件例子分享
- php使用百度翻譯api示例分享
- php獲取從百度搜索進(jìn)入網(wǎng)站的關(guān)鍵詞的詳細(xì)代碼
- php檢測(cè)網(wǎng)頁是否被百度收錄的函數(shù)代碼
- php中通過curl檢測(cè)頁面是否被百度收錄
- php實(shí)現(xiàn)查詢百度google收錄情況(示例代碼)
- 比較簡(jiǎn)單的百度網(wǎng)盤文件直鏈PHP代碼
- php生成百度sitemap站點(diǎn)地圖類函數(shù)實(shí)例
相關(guān)文章
php將圖片文件轉(zhuǎn)換成二進(jìn)制輸出的方法
這篇文章主要介紹了php將圖片文件轉(zhuǎn)換成二進(jìn)制輸出的方法,涉及php針對(duì)圖片文件的讀取與轉(zhuǎn)換輸出技巧,需要的朋友可以參考下2015-06-06
php準(zhǔn)確計(jì)算復(fù)活節(jié)日期的方法
這篇文章主要介紹了php準(zhǔn)確計(jì)算復(fù)活節(jié)日期的方法,涉及php操作日期的技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-04-04
php實(shí)現(xiàn)統(tǒng)計(jì)二進(jìn)制中1的個(gè)數(shù)算法示例
這篇文章主要介紹了php實(shí)現(xiàn)統(tǒng)計(jì)二進(jìn)制中1的個(gè)數(shù)算法,結(jié)合實(shí)例形式分析了php字符串遍歷、判斷、統(tǒng)計(jì)等相關(guān)操作技巧,需要的朋友可以參考下2018-01-01
調(diào)試一段PHP程序時(shí)遇到的三個(gè)問題
調(diào)試一段PHP程序時(shí)遇到的三個(gè)問題,學(xué)習(xí)php的朋友可以參考下。2012-01-01

