Google非公式天気予報API [Google Weather API] TEST
class googleWeatherApi
www.xxxx.net/googleWeatherApi/googleWeatherApi_class.php
$googleWeatherApi_class->jsApi()
javascript形式で成形したHTMLを返す
$googleWeatherApi_class->getHtml( $p1:string , $p2:string , $hl:string , $html:string )
デフォルトテンプレートを選択し成形したHTMLを返す
| 引数 | 内容 | 型 | 初期値 | サンプル |
|---|---|---|---|---|
| $p1 | 都市名 | string | NULL | sapporo、札幌、札幌市 |
| $p2 | 地域名 | string | NULL | hokkaido、北海道 |
| $hl | 国コード(言語) | string | NULL | jp |
| $html | htmlテンプレート選択 | string | NULL | Null or 'simple' or 'today' |
| 戻り値 | 内容 |
|---|---|
| html | 成形済みHTMLソース |
$googleWeatherApi_class->attach( $p1:string , $p2:string , $hl:string , $html:string )
$htmlをテンプレートとし配列をアタッチしHTMLへ成形
| 引数 | 内容 | 型 | 初期値 | サンプル |
|---|---|---|---|---|
| $p1 | 都市名 | string | NULL | sapporo、札幌、札幌市 |
| $p2 | 地域名 | string | NULL | hokkaido、北海道 |
| $hl | 国コード(言語) | string | NULL | jp |
| $html | htmlテンプレート | string | NULL | HTML(アタッチ方法は以下を参照) |
| 戻り値 | 内容 |
|---|---|
| html | 成形済みHTMLソース |
値アタッチ方法
{{ 配列の頭文字2文字 / 項目名 }}
例){{cc/condition}} => にわか雨
forecast_conditions の場合、{{ 配列の頭文字2文字fc : 配列番号 / 項目名 }}
例){{fc:3/month}} => 9
例){{cc/condition}} => にわか雨
forecast_conditions の場合、{{ 配列の頭文字2文字fc : 配列番号 / 項目名 }}
例){{fc:3/month}} => 9
※値は以下、googleWeatherApi_class の 戻りobject の詳細参照
[ テンプレートのCSSサンプル ]
[ テンプレートのHTMLサンプル ] (改行コードは含めないでください)
{{fi/postal_code2}}{{fi/postal_code1}} {{fi/month}}/{{fi/day}}
{{cc/img_tag}}
{{cc/condition}}
{{cc/condition}}
{{cc/temp_c}}℃
{{cc/humidity}}
{{cc/wind_condition}}
$googleWeatherApi_class->getArr( $p1:string , $p2:string , $hl:string )
引数からxmlを入手し配列へ再加工
| 引数 | 内容 | 型 | 初期値 | サンプル |
|---|---|---|---|---|
| $p1 | 都市名 | string | NULL | sapporo、札幌、札幌市 |
| $p2 | 地域名 | string | NULL | hokkaido、北海道 |
| $hl | 国コード(言語) | string | NULL | jp |
| 戻り値 | 内容 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| object | 地域情報・今日の天気・今日から3日後までの4日間の天気予報
|
[ リターンオブジェクトのサンプル ]
[humidity_only] => 94%
[wind_condition_only] => 南東 3 m/s
)
[forecast_conditions] => Array
(
[0] => Array
(
[day_of_week] => 火
[low] => 21
[high] => 22
[icon] => http://www.google.com/ig/images/weather/jp_rainy.gif
[condition] => 雨
[img_tag] =>
[time_stamp] => 1315234800
[forecast_date] => 2011-09-06
[year] => 2011
[year_ja] => 23
[month] => 9
[day] => 6
)
[1] => Array
(
[day_of_week] => 水
[low] => 16
[high] => 24
[icon] => http://www.google.com/ig/images/weather/jp_rainysometimescloudy.gif
[condition] => 雨の可能性
[img_tag] =>
[time_stamp] => 1315321200
[forecast_date] => 2011-09-07
[year] => 2011
[year_ja] => 23
[month] => 9
[day] => 7
)
[2] => Array
(
[day_of_week] => 木
[low] => 17
[high] => 27
[icon] => http://www.google.com/ig/images/weather/jp_rainysometimescloudy.gif
[condition] => 雨の可能性
[img_tag] =>
[time_stamp] => 1315407600
[forecast_date] => 2011-09-08
[year] => 2011
[year_ja] => 23
[month] => 9
[day] => 8
)
[3] => Array
(
[day_of_week] => 金
[low] => 19
[high] => 28
[icon] => http://www.google.com/ig/images/weather/jp_sunny.gif
[condition] => ところにより晴れ
[img_tag] =>
[time_stamp] => 1315494000
[forecast_date] => 2011-09-09
[year] => 2011
[year_ja] => 23
[month] => 9
[day] => 9
)
)
)$googleWeatherApi_class->rawXml( $p1:string , $p2:string , $hl:string )
引数から Google Weather にてxmlを取得
| 引数 | 内容 | 型 | 初期値 | サンプル |
|---|---|---|---|---|
| $p1 | 都市名 | string | NULL | sapporo、札幌、札幌市 |
| $p2 | 地域名 | string | NULL | hokkaido、北海道 |
| $hl | 国コード(言語) | string | NULL | jp |
| 戻り値 | 内容 |
|---|---|
| xml | Google Weather 純正データ |