首页 > php开发 > php 利用Google API 获取当前天气信息代码

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

本文章分享一款只要三行就能取得你指定城市天气信息的php+google api实现代码,代码如下:

<?php 
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=长沙');  
$information = $xml->xpath("/xml_api_reply/weather/current_conditions/condition");  
echo $information[0]->attributes(); 	

               
               

永久地址:http://www.phprm.com/develop/fs1020.html

转载随意~请带上教程地址吧^^

标签:获取 google api 天气信息

相关文章

发表留言