百度天气预报接口
来源:互联网 发布:三明学院网络教学平台 编辑:程序博客网 时间:2024/06/05 08:29
原文地址:http://www.cnblogs.com/txw1958/p/baidu-weather-forecast-api.html
百度提供天气预报查询接口API,可以根据经纬度/城市名查询天气情况,我们可以在微信公众平台开发中调用这一接口。
接口说明
根据经纬度/城市名查询天气的结果
接口示例
http://api.map.baidu.com/telematics/v3/weather?location=北京&output=json&ak=yourkey
百度ak申请地址:http://lbsyun.baidu.com/apiconsole/key
接口参数说明
返回结果
返回xml格式的数据
<?xml version="1.0" encoding="utf-8" ?> <CityWeatherResponse> <status>success</status> <date>2014-05-03</date> <results> <currentCity>北京</currentCity> <weather_data> <date>周六(今天, 实时:22℃)</date> <dayPictureUrl>http://api.map.baidu.com/images/weather/day/leizhenyu.png</dayPictureUrl> <nightPictureUrl>http://api.map.baidu.com/images/weather/night/duoyun.png</nightPictureUrl> <weather>雷阵雨转多云</weather> <wind>北风5-6级</wind> <temperature>24 ~ 11℃</temperature> <date>周日</date> <dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl> <nightPictureUrl>http://api.map.baidu.com/images/weather/night/qing.png</nightPictureUrl> <weather>多云转晴</weather> <wind>北风4-5级</wind> <temperature>19 ~ 8℃</temperature> <date>周一</date> <dayPictureUrl>http://api.map.baidu.com/images/weather/day/qing.png</dayPictureUrl> <nightPictureUrl>http://api.map.baidu.com/images/weather/night/qing.png</nightPictureUrl> <weather>晴</weather> <wind>微风</wind> <temperature>21 ~ 9℃</temperature> <date>周二</date> <dayPictureUrl>http://api.map.baidu.com/images/weather/day/duoyun.png</dayPictureUrl> <nightPictureUrl>http://api.map.baidu.com/images/weather/night/qing.png</nightPictureUrl> <weather>多云转晴</weather> <wind>微风</wind> <temperature>21 ~ 10℃</temperature> </weather_data> </results></CityWeatherResponse>
返回json格式的数据
{ "error": 0, "status": "success", "date": "2014-05-03", "results": [ { "currentCity": "北京", "weather_data": [ { "date": "周六(今天, 实时:22℃)", "dayPictureUrl": "http://api.map.baidu.com/images/weather/day/leizhenyu.png", "nightPictureUrl": "http://api.map.baidu.com/images/weather/night/duoyun.png", "weather": "雷阵雨转多云", "wind": "北风5-6级", "temperature": "24 ~ 11℃" }, { "date": "周日", "dayPictureUrl": "http://api.map.baidu.com/images/weather/day/duoyun.png", "nightPictureUrl": "http://api.map.baidu.com/images/weather/night/qing.png", "weather": "多云转晴", "wind": "北风4-5级", "temperature": "19 ~ 8℃" }, { "date": "周一", "dayPictureUrl": "http://api.map.baidu.com/images/weather/day/qing.png", "nightPictureUrl": "http://api.map.baidu.com/images/weather/night/qing.png", "weather": "晴", "wind": "微风", "temperature": "21 ~ 9℃" }, { "date": "周二", "dayPictureUrl": "http://api.map.baidu.com/images/weather/day/duoyun.png", "nightPictureUrl": "http://api.map.baidu.com/images/weather/night/qing.png", "weather": "多云转晴", "wind": "微风", "temperature": "21 ~ 10℃" } ] } ]}
效果如下:
0 0
- 百度天气预报接口
- 百度天气预报接口
- 百度天气预报接口
- 百度天气预报接口
- 百度天气预报接口
- 百度天气预报接口介绍
- 百度天气预报接口
- 百度天气预报接口
- 百度天气预报接口介绍
- 百度天气预报接口介绍
- 百度天气预报接口介绍
- Android天气预报+百度天气接口
- Android天气预报,Json解析,百度天气接口
- 百度提供天气预报查询接口API
- java天气预报调用百度接口实现
- 如何使用百度天气预报API接口
- 百度天气预报接口介绍--职坐标
- 如何使用百度天气预报API接口
- 图的最短路径
- XmlRootElement JAXB注解
- AndroidManifest.xml详解(下)
- 全双工和半双工的区别
- 无法将类型为“Shell32.ShellClass”的 COM 对象强制转换为接口类型“Shell32.IShellDispatch 6”
- 百度天气预报接口
- OSG开发概览
- STL学习笔记之容器--stack
- windows窗口样式
- jQuery开发之DOM操作三
- 新东西006--Activity启动模式
- [Erlang]port(gen_tcp)如何并行?
- 第一章:Android之Linux(Ubuntu)环境配置
- Mapped Statements collection does not contain value for xxxx