Home  >  Article  >  Backend Development  >  求php抓取网站天气代码,该如何处理

求php抓取网站天气代码,该如何处理

WBOY
WBOYOriginal
2016-06-13 13:40:44853browse

求php抓取网站天气代码
求php抓取网站天气代码

------解决方案--------------------
基本上都有接口的,新浪的,腾讯的等等
http://www.weather.com.cn/data/sk/101110101.html
http://m.weather.com.cn/data/101110101.html
等等
其中101110101是城市的代码,获得城市代码进入weather.com.cn
------解决方案--------------------

探讨

基本上都有接口的,新浪的,腾讯的等等
http://www.weather.com.cn/data/sk/101110101.html
http://m.weather.com.cn/data/101110101.html
等等
其中101110101是城市的代码,获得城市代码进入weather.com.cn

------解决方案--------------------
貌似几乎所有的这类工具都是这么抓的,voteon83 我一般也不告诉你..哈哈哈
探讨

引用:

基本上都有接口的,新浪的,腾讯的等等
http://www.weather.com.cn/data/sk/101110101.html
http://m.weather.com.cn/data/101110101.html
等等
其中101110101是城市的代码,获得城市代码进入weather.com.cn


+1,其实很多天气……

------解决方案--------------------
探讨
貌似几乎所有的这类工具都是这么抓的,voteon83 我一般也不告诉你..哈哈哈

引用:

引用:

基本上都有接口的,新浪的,腾讯的等等
http://www.weather.com.cn/data/sk/101110101.html
http://m.weather.com.cn/data/10111010……

------解决方案--------------------
有现成的接口供网页嵌入,何苦抓过来抓过去
------解决方案--------------------
探讨

有现成的接口供网页嵌入,何苦抓过来抓过去

------解决方案--------------------
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;
Statement:
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