求php抓取网站天气代码 求php抓取网站天气代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 基本上都有接口的,新浪的,腾讯的等等http://www.weather.com.cn/data/sk/101110101.htmlhttp://m.weather.com.cn/data/101110101.html等等其中101110101是城市的代码,获得城市代码进入weather.com.cn 貌似几乎所有的这类工具都是这么抓的,voteon83 我一般也不告诉你..哈哈哈 因为需要有自己的外观,那都是json格式的数据,用起来也很方便,何乐而不为呢? 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; 请教各位, 刚接触PHP 请问有快速学习的资料吗? 一个小问题PHP..在线等答案 请帮忙看看这个问题 400分求一个高难度的PHP清缓存的解决方案... imagettftext有人使用过这个函数吗? 关于向图片上写文字的函数 如何才能将站用空间压缩 菜鸟问题:传值问题 PHP事务的如何写? 谁能告诉我PHP里的->符号的意思啊? 用的是什么端口? 紧急求救! php怎么判断登陆,急,帮帮忙。在线等!!!
http://www.weather.com.cn/data/sk/101110101.html
http://m.weather.com.cn/data/101110101.html
等等
其中101110101是城市的代码,获得城市代码进入weather.com.cn
因为需要有自己的外观,那都是json格式的数据,用起来也很方便,何乐而不为呢?
$obj=json_decode($source);
echo $obj->weatherinfo->city.' '.$obj->weatherinfo->weather.' '.$obj->weatherinfo->temp1.'~'.$obj->weatherinfo->temp2;