PEAR/Services_Livedoor
をテンプレートにして作成
開始行:
#setlinebreak(on)
* お天気情報取得 Livedoor Weather Hacks API PEAR::Servi...
#htmlinsert(googleAdsense.html)
#ref(http://dozo.rgr.jp/img/img20_file.png,right,nolink,a...
天気情報取得するには、
どこかの天気情報サイトと契約して情報をもらうか、
RSSから取得するか。
果ては、[[PEAR::Services_Weather>http://pear.php.net/pack...
どれもこれもイマイチなのだが、
この[[PEAR::Services_Livedoor>http://d.hatena.ne.jp/p4l...
(ノ・・)ン。。。。。。(((●コロコロッ
インストールは至って簡単。
# pear install http://p4life.jp/services_livedoor/Servic...
使い方も至って簡単。
$city_idというLivedoor側が設定している日本全国142箇所の都...
天気情報が”配列で”取得できます。
第二引数にはいつの天気を取得するかを設定する。
パラメータ値はtoday,tomorrow,dayaftertomorrowの三種類。
取得できるデータは[[お天気Webサービス仕様>http://weather....
ソースはこんな感じ。
<?
require_once ("Services/Livedoor/Weather.php");
$city_id = 57;
// new Services_Livedoor_Weather Object
$lwwsObj = & new Services_Livedoor_Weather();
$lwwsArray = & $lwwsObj->get( (int)$city_id, (str...
print_r( $lwwsArray );
?>
結果はこんな感じ
Array
(
[author] => livedoor Weather Team.
[location] =>
[title] => 栃木県 大田原 - 今日の天気
[link] => http://weather.livedoor.com/area/9/57.h...
[forecastday] => today
[day] => Sunday
[forecastdate] => Sun, 26 Feb 2006 00:00:00 +0900
[publictime] => Sat, 25 Feb 2006 17:00:00 +0900
[telop] => 曇のち雨
[description] => 栃木県北部山地の積雪の多い所では...
北海道の東には高気圧があっ...
[image] => Array
(
[title] => 曇のち雨
[link] => http://weather.livedoor.com/are...
[url] => http://image.weather.livedoor.co...
[width] => 50
[height] => 31
)
[temperature] => Array
(
[max] => Array
(
[celsius] => 8
[fahrenheit] => 46.4
)
[min] => Array
(
[celsius] => 4
[fahrenheit] => 39.2
)
)
[pinpoint] => Array
(
[location] => Array
(
[0] => Array
(
[title] => 日光市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[1] => Array
(
[title] => 今市市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[2] => Array
(
[title] => 大田原市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[3] => Array
(
[title] => 矢板市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[4] => Array
(
[title] => 那須塩原市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[5] => Array
(
[title] => 足尾町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[6] => Array
(
[title] => 栗山村
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[7] => Array
(
[title] => 藤原町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[8] => Array
(
[title] => 塩谷町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[9] => Array
(
[title] => 湯津上村
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[10] => Array
(
[title] => 黒羽町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[11] => Array
(
[title] => 那須町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
)
)
[copyright] => Array
(
[title] => Copyright (C) 1996-2006 livedo...
[link] => http://weather.livedoor.com
[image] => Array
(
[title] => livedoor 天気情報
[link] => http://weather.livedoor...
[url] => http://image.weather.liv...
[width] => 118
[height] => 26
)
[provider] => Array
(
[0] =>
[1] =>
)
)
)
city_idは都市名("さいたま"とか)でも取得できるが、1-142ま...
気象台発表は朝5時、昼11時、夕方17時の合計3回。
発表したときにはすでに反映されているので、
一日3回全国のデータを取得すれば最新の天気が取得できる。
注意点
LWWSは最高気温、最低気温が取得できない場合がある。
descriptionは全文取得できない
欠点
ナンデ配列?
#comment
終了行:
#setlinebreak(on)
* お天気情報取得 Livedoor Weather Hacks API PEAR::Servi...
#htmlinsert(googleAdsense.html)
#ref(http://dozo.rgr.jp/img/img20_file.png,right,nolink,a...
天気情報取得するには、
どこかの天気情報サイトと契約して情報をもらうか、
RSSから取得するか。
果ては、[[PEAR::Services_Weather>http://pear.php.net/pack...
どれもこれもイマイチなのだが、
この[[PEAR::Services_Livedoor>http://d.hatena.ne.jp/p4l...
(ノ・・)ン。。。。。。(((●コロコロッ
インストールは至って簡単。
# pear install http://p4life.jp/services_livedoor/Servic...
使い方も至って簡単。
$city_idというLivedoor側が設定している日本全国142箇所の都...
天気情報が”配列で”取得できます。
第二引数にはいつの天気を取得するかを設定する。
パラメータ値はtoday,tomorrow,dayaftertomorrowの三種類。
取得できるデータは[[お天気Webサービス仕様>http://weather....
ソースはこんな感じ。
<?
require_once ("Services/Livedoor/Weather.php");
$city_id = 57;
// new Services_Livedoor_Weather Object
$lwwsObj = & new Services_Livedoor_Weather();
$lwwsArray = & $lwwsObj->get( (int)$city_id, (str...
print_r( $lwwsArray );
?>
結果はこんな感じ
Array
(
[author] => livedoor Weather Team.
[location] =>
[title] => 栃木県 大田原 - 今日の天気
[link] => http://weather.livedoor.com/area/9/57.h...
[forecastday] => today
[day] => Sunday
[forecastdate] => Sun, 26 Feb 2006 00:00:00 +0900
[publictime] => Sat, 25 Feb 2006 17:00:00 +0900
[telop] => 曇のち雨
[description] => 栃木県北部山地の積雪の多い所では...
北海道の東には高気圧があっ...
[image] => Array
(
[title] => 曇のち雨
[link] => http://weather.livedoor.com/are...
[url] => http://image.weather.livedoor.co...
[width] => 50
[height] => 31
)
[temperature] => Array
(
[max] => Array
(
[celsius] => 8
[fahrenheit] => 46.4
)
[min] => Array
(
[celsius] => 4
[fahrenheit] => 39.2
)
)
[pinpoint] => Array
(
[location] => Array
(
[0] => Array
(
[title] => 日光市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[1] => Array
(
[title] => 今市市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[2] => Array
(
[title] => 大田原市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[3] => Array
(
[title] => 矢板市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[4] => Array
(
[title] => 那須塩原市
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[5] => Array
(
[title] => 足尾町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[6] => Array
(
[title] => 栗山村
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[7] => Array
(
[title] => 藤原町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[8] => Array
(
[title] => 塩谷町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[9] => Array
(
[title] => 湯津上村
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[10] => Array
(
[title] => 黒羽町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
[11] => Array
(
[title] => 那須町
[link] => http://weather....
[publictime] => Sun, 26 F...
)
)
)
[copyright] => Array
(
[title] => Copyright (C) 1996-2006 livedo...
[link] => http://weather.livedoor.com
[image] => Array
(
[title] => livedoor 天気情報
[link] => http://weather.livedoor...
[url] => http://image.weather.liv...
[width] => 118
[height] => 26
)
[provider] => Array
(
[0] =>
[1] =>
)
)
)
city_idは都市名("さいたま"とか)でも取得できるが、1-142ま...
気象台発表は朝5時、昼11時、夕方17時の合計3回。
発表したときにはすでに反映されているので、
一日3回全国のデータを取得すれば最新の天気が取得できる。
注意点
LWWSは最高気温、最低気温が取得できない場合がある。
descriptionは全文取得できない
欠点
ナンデ配列?
#comment
ページ名:
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
] [
リンク元
]
Third Project
証券会社ランキング比較