php获取百度最新事件,如下代码:
function getbaiduhotkeyword() { $templaterss = file_get_contents('http://top.baidu.com/rss_xml.php?p=shijian'); if (preg_match('/(.*)/is', $templaterss, $_description)) { $templaterss = $_description[0]; $templaterss = str_replace(&, &, $templaterss); } $templaterss = .trim($templaterss); $xml = simplexml_load_string($templaterss); foreach ($xml->tbody->tr as $temp) { if (!emptyempty ($temp->td->a)) { $keyarray [] = trim(($temp->td->a)); } } return $keyarray; }