本文章分享一款只要三行就能取得你指定城市天氣信息的php+google api實現代碼,代碼如下:
- <?
- $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();
- ?>
新聞熱點
疑難解答