Home  >  Article  >  Backend Development  >  PHP做天气预报采集程序解决方案

PHP做天气预报采集程序解决方案

WBOY
WBOYOriginal
2016-06-13 13:45:301011browse

PHP做天气预报采集程序
求解答:PHP做天气预报采集程序,根据访问者的ip,判断得出当前城市天气预报。

------解决方案--------------------
先获取用户ip 通过ip得到用户所在地,然后通过所在地获取天气信息,下面是两个接口:

http://counter.sina.com.cn/ip/

http://www.google.com/ig/api?hl=zh-cn&weather=shanghai
------解决方案--------------------
Google的天气api weather参数可以填中文

http://www.google.com/ig/api?hl=zh-cn&weather=上海

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