教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 Google API 获取当前天气信息的php代码

Google API 获取当前天气信息的php代码

发布时间:2015-12-20   编辑:jiaochengji.com
php通过Google API获取当前天气信息,只需 3 行代码,大家在使用时只需要把其中的 ADDRESS 换成你想要的城市即可。

代码如下:

<?php
/**
 * Google API应用
 * 获取某城市的当天天气
 * by http://www.jbxue.com
*/
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=ADDRESS'); 
  $information = $xml->xpath("/xml_api_reply/weather/current_conditions/condition"); 
  echo $information[0]->attributes();
?>
您可能感兴趣的文章:
php 天气预报代码一例
php调用yahoo sina api天气预报的实现代码
php调用google天气api的实例代码

您可能感兴趣的文章:
Google API 获取当前天气信息的php代码
php调用google天气api的实例代码
php 利用Google API 获取当前天气信息代码
php 天气预报代码一例
php百度天气小偷实现代码
PHP调用百度天气接口API实现查询实时天气
php获取google当前天气实现程序
PHP数据采集程序采集天气网数据实例演示
php ajax实现无刷新获取天气状态
php调用yahoo sina api天气预报的实现代码

[关闭]
~ ~