Programming: February 2011 Archives

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%

PHP clear terminal screen

user-pic
Vote 0 Votes

echo chr(27).chr(91).'H'.chr(27).chr(91).'J'; // ^[H^[J

If not work, echo $TERM and check cl= value in /etc/termcap

About this Archive

This page is an archive of entries in the Programming category from February 2011.

Programming: March 2010 is the previous archive.

Programming: March 2011 is the next archive.

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

Monthly Archives