php使用百度天气接口示例
2014-04-22 00:00
886 查看
注意地区要转码的
百度ak申请地址:http://lbsyun.baidu.com/apiconsole/key
百度ak申请地址:http://lbsyun.baidu.com/apiconsole/key
<?php $city="嘉兴"; $content = file_get_contents("http://api.map.baidu.com/telematics/v3/weather?location=%E5%98%89%E5%85%B4&output=json&ak=5slgyqGDENN7Sy7pw29IUvrZ"); print_r(json_decode($content));
{ error: 0, status: "success", date: "2014-04-18", results: [ { currentCity: "嘉兴", weather_data: [ { date: "今天(周三)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "多云", wind: "微风", temperature: "23℃" }, { date: "明天(周四)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/leizhenyu.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/zhongyu.png", weather: "雷阵雨转中雨", wind: "微风", temperature: "29~22℃" }, { date: "后天(周五)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/yin.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "阴转多云", wind: "微风", temperature: "31~23℃" }, { date: "大后天(周六)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "多云", wind: "微风", temperature: "31~24℃" } ] }, { currentCity: "合肥市", weather_data: [ { date: "今天(周三)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "多云", wind: "东风3-4级", temperature: "27℃" }, { date: "明天(周四)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "多云", wind: "东北风3-4级", temperature: "35~27℃" }, { date: "后天(周五)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "多云", wind: "南风", temperature: "35~27℃" }, { date: "大后天(周六)", dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png", nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png", weather: "多云", wind: "东风", temperature: "34~27℃" } ] } ] }
相关文章推荐
- php使用百度天气接口示例
- 使用百度接口获取天气
- PHP调用百度天气接口API
- 天气预报接口使用及示例
- php使用curl检测网页是否被百度收录的示例分享
- 基于zhphpWeixinApi.class.php 接口类使用示例
- php快递单号查询接口使用示例
- php快递单号查询接口使用示例
- 百度定位与百度天气预报接口的使用
- 全国天气预报数据接口调用PHP示例
- php调用百度天气接口,微信实时查看天气
- 百度天气预报接口使用详细
- php 接口使用示例
- 百度天气接口使用说明
- php接口和抽象类使用示例详解
- php使用curl检测网页是否被百度收录的示例分享
- PHP 使用 微信JSSDK 拍照选择图片接口 利用localid预览时 安卓手机正常显示 iOS手机不显示
- 用Php扩展实现的简单框架 - 6 - 使用示例
- php api接口优化和使用