Google Wether API

user-pic
Vote 0 Votes

Google Wether API 算是非官方的 API, Google 並沒有文件提到此 API 的使用
使用方式很簡單, 用城市名當變數即可, 回傳的結果是 XML, 有目前溫度及未來幾天的預報
例如: http://www.google.com.tw/ig/api?weather=Taipei
也可以用經緯度, 格式是 ,,,經度x1000000,緯度x1000000

用 wget 取得台中目前的溫濕度
# wget -qO- 'http://www.google.com.tw/ig/api?weather=Taichung' | tr '/' '\n' | awk -F'[\" ]' '/temp_c|humidity/ {print $(NF-1)}'
11
86%

Leave a comment

About this Entry

This page contains a single entry by Pank published on February 14, 2011 1:18 PM.

PHP clear terminal screen was the previous entry in this blog.

sipcalc - IPv4/IPv6 subnet calculator is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives