<?php
/*
* Author : Codenow
* Email : Codenow@qq.com
* Blog : http://hi.baidu.com/codenow
*/
$url = "http://www.baidu.com/s?wd=北京天气";
$content =
file_get_contents($url);
preg_match_all('/id="1"><tr>(.+?)<div class="al_wlink">/si',$content,$result);
$Weather = $result[1][0];
$Weather= trim($Weather);
$Weather= str_replace("n","",$Weather);
$Weather= str_replace("<td class="f">","",$Weather);
print "$Weather";
?>