This article shares a php+google api implementation code that can obtain the weather information of your specified city in just three lines. Friends in need can refer to it.
The code is as follows
代码如下 |
复制代码 |
$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();
?>
|
|
Copy code |
|
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=Changsha');
$information = $xml->xpath("/xml_api_reply/weather/current_conditions/condition");
echo $information[0]->attributes();
?>
http://www.bkjia.com/PHPjc/631654.htmlwww.bkjia.com
trueTechArticleThis article shares a php+google api implementation code that can obtain the weather information of your specified city in just three lines. Friends in need can refer to it. The code is as follows Copy code ? $xml = si...