Home > Backend Development > PHP Tutorial > 2009nba finals data php code to obtain Baidu's hot word data

2009nba finals data php code to obtain Baidu's hot word data

WBOY
Release: 2016-07-29 08:48:01
Original
1075 people have browsed it

Copy the code The code is as follows:


/**
* Get Baidu’s hot words
* @user 小杰
* @from http://www.isharey.com/?p=354
* @return array Return Baidu’s hot word data (array return)
*/
function getBaiduHotKeyWord()
{
$templateRss = file_get_contents('http://top.baidu.com/ rss_xml.php?p=top10');
If (preg_match('/

(.*)
/is', $templateRss, $_description)) {
$templateRss = $_description [0 ];
$templateRss = str_replace("&", "&", $templateRss);
}
$templateRss = "" . $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());

The above introduces the 2009nba finals data php code to obtain Baidu's hot word data, including the 2009nba finals data. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template