注意地区要转码的

百度ak申请地址:http://lbsyun.baidu.com/apiconsole/key

复制代码 代码如下:

$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调用百度天气接口,php使用百度天气接口示例相关推荐

  1. python调用(百度云、腾讯云)API接口表格识别并保存为excel

    Python表格识别 图像识别具有较高的商业价值,本节主要通过python调用(百度云.腾讯云)API接口表格识别并保存为excel分析表格识别的能力: 提示:需分别申请密钥,在相应位置添加自己密钥即 ...

  2. 百度首页天气html制作,使用百度天气API实现自己的天气预报

    昨天在简书看到一篇帖子是关于百度天气API的,感觉很棒,所以今天自己也写了个自己的天气预报,利用jsonp跨域请求,实现自己的天气预报展示.展示github链接:https://lwjcode.git ...

  3. php百度地图接口两点测距,百度地图Api 根据两个坐标点计算距离

    百度地图Android Sdk的Api里面,没有现成的直接获取两个坐标点之间距离的方法,但是,在jsapi里面,有直接计算距离的方法. class Point: pass def max(a,b): ...

  4. unity学习笔记-番外(接入百度和轻语的AI智能接口实现语音识别和语音播放)

    接入百度和轻语的AI智能接口实现语音识别和语音播放 语音识别 思路 代码 语音合成 思路 总结 语音识别 思路 先在百度和轻语申请接口,获得appkey和secretkey(这是为了获得鉴权,也就是t ...

  5. 微信公众号开发(5)-调用jssdk获取地理位置经纬度及百度api获得城市

    调用微信的jssdk需要先绑定js安全域名,这个在微信公众号后台自己设置就可以了. 还需要引入js文件,但由于我使用了vux,它里面的WeChatPlugin这个插件可以直接用commonJS方式引用 ...

  6. Flutter 调用地图软件(高德、百度、腾讯、苹果)同时实现另类国际化

    文章目录 Flutter 调用地图软件(高德.百度.腾讯.苹果) 一.说明 第 1 类:App 集成导航功能 第 2 类:跳转第三方地图软件 二.实现步骤 使用 1.添加插件: 2.iOS 配置 in ...

  7. python语言+selenium自动化,编写脚本调用Chrome、Firefox浏览器打开百度网站

    python语言+selenium自动化,编写脚本调用Chrome.Firefox浏览器打开百度网站 目标:初始化一个webdriver实例对象driver,通过webdriver.Chrome()和 ...

  8. php调用百度地图定位,php用百度地图API进行IP定位和GPS定位

    /** * 根据地理坐标获取国家.省份.城市,及周边数据类(利用百度Geocoding API实现) * 百度密钥获取方法:http://lbsyun.baidu.com/apiconsole/key ...

  9. 百度的搜索下拉菜单数据接口

    function Search(){ this.txt = document.getElementById("txt"); this.list = document.getElem ...

  10. 用php写百度收录api推送,百度实时推送api接口应用示例

    网站质量不错的网站可以在百度站长平台/数据提交/sitemap栏目下看到实时推送的功能, 目前这个工具是邀请开放, 百度的实时推送的api接口可以实时推送我们新发布的文章, 保证百度在第一时间收录.  ...

最新文章

  1. 985博士分享Pytorch与Tensorflow,哪个更值得你学习?
  2. 【正则表达式系列】一些概念(字符组、捕获组、非捕获组)
  3. Ubuntu用命令行发邮件mutt,报警发短信通知
  4. 简单了解一下函数模板
  5. 每日程序C语言30-static作用
  6. 38、JAVA_WEB开发基础之下载功能
  7. 平衡二叉搜索树的创建
  8. python装逼_能够让你装逼的10个Python小技巧
  9. python的scale方法的变体以及使用_Python with用法实例
  10. 深度学习模型的可视化技术总结
  11. NO.76 禅道使用分享第八期:创维软件开发团队畅谈专业版
  12. 没有任何机械基础,如何自学机械设计?
  13. npm warn config global `--global`, `--local` are deprecated. use `--location=global` instead.
  14. 2021年茶艺师(中级)考试内容及茶艺师(中级)操作证考试
  15. 数字取证wireshark流量分析
  16. 微信php带菜单事件,phpcms微信插件自定义菜单绑定栏目获取消息的实现与应用
  17. 模数转换器ADC的常用术语和主要技术s指标(完)
  18. wps 写论文时 参考文献的横线怎么消除
  19. AAM Alignment最后一篇:Robust AAM Alignment with Occlusion
  20. Android 9.0 行为变更(一)针对所有 API 级别的应用

热门文章

  1. MFC——在视图窗口加载背景图片
  2. WM_PAINT介绍及OnPaint()函数的作用原理
  3. 深度学习(Deep Learning):循环神经网络一(RNN)
  4. dependency报红_解决IDEA中Maven依赖包导入失败报红问题(总结最有效8种解决方案)...
  5. python调用电脑蓝牙_python-从蓝牙设备获取响应
  6. 设置activity不可返回
  7. XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager,
  8. Android开发之解决NestedScrollView滑动监听兼容低版本的方法
  9. 西部数据硬盘支持linux,西部数据开发新的Linux文件系统“Zonefs” 支持在分区块设备上运行...
  10. UITextField中复制和粘贴为中文