求php抓取网站天气代码
求php抓取网站天气代码
——解决方案——————–
基本上都有接口的,新浪的,腾讯的等等
http://www.weather.com.cn/data/sk/101110101.html
http://m.weather.com.cn/data/101110101.html
等等
其中101110101是城市的代码,获得城市代码进入weather.com.cn
——解决方案——————–
——解决方案——————–
貌似几乎所有的这类工具都是这么抓的,voteon83 我一般也不告诉你..哈哈哈
——解决方案——————–
——解决方案——————–
有现成的接口供网页嵌入,何苦抓过来抓过去
——解决方案——————–
——解决方案——————–
http://6shandong.com/123/weatherplugin.html
——解决方案——————–
$source = file_get_contents(“http://www.weather.com.cn/data/cityinfo/”.$carr[1].”.html”);
$obj=json_decode($source);
echo $obj->weatherinfo->city.’ ‘.$obj->weatherinfo->weather.’ ‘.$obj->weatherinfo->temp1.’~’.$obj->weatherinfo->temp2;