PHP抓取百度实时热词(新)

<?php
$data = @file_get_contents("http://top.baidu.com/board?tab=realtime");
preg_match_all('/<div class="c-single-text-ellipsis"> ([^<>]*) /', $data, $arr_infos);
for ($i=0;$i<32;$i++){
echo "<a href=\"https://www.baidu.com/s?wd=".$arr_infos[1][$i]."\">".$arr_infos[1][$i]."</a>";}
?>

Powered by WordPress. Theme by Alx.