日記/2021-03-16
をテンプレートにして作成
ホーム
検索
最終更新
テスト
リンク
ヘルプ
新規
pukiwiki-official
pukiwiki-dev
ヘルプ
プラグインヘルプ
開始行:
***supermonの地域温度表示 [#g0286239]
AllstarLinkのコントロール画面(supermon)の初期地域温度表...
地域しか対応してないので、日本国内対応版にlink.phpを改変...
参考:[[PHPで天気を取得、表示させたい!OpenWeatherMap API...
+【概要】
Webサーバ上に、wth.phpを作成する。 --- /var/www/html/wt...
1.自Webserver 上にwth.phpを作成する
2.link.phpを改修して、wth.phpをアクセスさせる
3.得られた文字列を加工・抽出して表示させる
具体的に要求するURLは
[[http://api.openweathermap.org/data/2.5/weather?q=mob...
※appidは個人で得たAPIのid。http://192.168.xx.yy/wth.php...
w_iconMobaraw_nameTemp_16_degfew clouds_Description_Pres...
が得られ、このTemp_16_deg を抽出する。
+【詳細】
/var/www/html/wth.php ----
<!DOCTYPE html>
<html>
<head>
<title>OpenWeather</title>
</head>
<body>
<?php
$url = "http://api.openweathermap.org/data/2.5/weather?q...
$city = 'mobara,jp&';
$appid = 'appid=b31f206a2ad51c9a3928e4ed36e0c0ac';
#$url = $city.$appid;
$url = "http://api.openweathermap.org/data/2.5/weather?q...
$icon = '<img align="middle" style="width:45px;" src="ht...
$k_temp = 273.15;
$json = file_get_contents($url);
$json = mb_convert_encoding($json, 'UTF8', 'ASCII,JIS,UT...
$arr = json_decode($json,true);
if ($arr === NULL) {
return;
}else{
$weather_temp = $arr["main"]["temp"] - $k_temp;
$weather_temp_min = $arr["main"]["temp_min"] - $k_te...
$weather_temp_max = $arr["main"]["temp_max"] - $k_te...
$weather_id = $arr["weather"][0]["id"];
$weather_description = $arr["weather"][0]["descripti...
$weather_icon = $icon.$arr["weather"][0]["icon"].'.p...
$weather_main = $arr["main"]["temp_min"];
$weather_lat = $arr["coord"]["lat"];
$weather_lon = $arr["coord"]["lon"];
$weather_pressure = $arr["main"]["pressure"];
$weather_humidity = $arr["main"]["humidity"];
$weather_speed = $arr["wind"]["speed"];
$weather_name = $arr["name"];
$weather_country = $arr["sys"]["country"];
$weather_sunrise = $arr["sys"]["sunrise"];
$weather_sunset = $arr["sys"]["sunset"];
echo '<p style="position: static;margin:0;">';
echo($weather_icon.'w_icon');
echo($weather_name.'w_name');
echo('Temp_'.intval($weather_temp).'_deg');
echo($weather_description.'_Description_');
echo('Press_'.$weather_pressure.'_hpascal');
echo('Wind_'.$weather_speed.'_m/s');
echo 'Sunrise:'.date( "H:m:s" , $weather_sunrise ).'';
echo 'Sunset:'.date( "H:m:s" , $weather_sunset ).'<b...
echo '</p>';
}
echo('Wind_'.$weather_speed.'_m/s');
echo 'Sunrise:'.date( "H:m:s" , $weather_sunrise ).'';
echo 'Sunset:'.date( "H:m:s" , $weather_sunset ).'<b...
echo '</p>';
}
?>
</body>
</html>?>
</body>
</html>
''&color(Red){以下工事中};''
終了行:
***supermonの地域温度表示 [#g0286239]
AllstarLinkのコントロール画面(supermon)の初期地域温度表...
地域しか対応してないので、日本国内対応版にlink.phpを改変...
参考:[[PHPで天気を取得、表示させたい!OpenWeatherMap API...
+【概要】
Webサーバ上に、wth.phpを作成する。 --- /var/www/html/wt...
1.自Webserver 上にwth.phpを作成する
2.link.phpを改修して、wth.phpをアクセスさせる
3.得られた文字列を加工・抽出して表示させる
具体的に要求するURLは
[[http://api.openweathermap.org/data/2.5/weather?q=mob...
※appidは個人で得たAPIのid。http://192.168.xx.yy/wth.php...
w_iconMobaraw_nameTemp_16_degfew clouds_Description_Pres...
が得られ、このTemp_16_deg を抽出する。
+【詳細】
/var/www/html/wth.php ----
<!DOCTYPE html>
<html>
<head>
<title>OpenWeather</title>
</head>
<body>
<?php
$url = "http://api.openweathermap.org/data/2.5/weather?q...
$city = 'mobara,jp&';
$appid = 'appid=b31f206a2ad51c9a3928e4ed36e0c0ac';
#$url = $city.$appid;
$url = "http://api.openweathermap.org/data/2.5/weather?q...
$icon = '<img align="middle" style="width:45px;" src="ht...
$k_temp = 273.15;
$json = file_get_contents($url);
$json = mb_convert_encoding($json, 'UTF8', 'ASCII,JIS,UT...
$arr = json_decode($json,true);
if ($arr === NULL) {
return;
}else{
$weather_temp = $arr["main"]["temp"] - $k_temp;
$weather_temp_min = $arr["main"]["temp_min"] - $k_te...
$weather_temp_max = $arr["main"]["temp_max"] - $k_te...
$weather_id = $arr["weather"][0]["id"];
$weather_description = $arr["weather"][0]["descripti...
$weather_icon = $icon.$arr["weather"][0]["icon"].'.p...
$weather_main = $arr["main"]["temp_min"];
$weather_lat = $arr["coord"]["lat"];
$weather_lon = $arr["coord"]["lon"];
$weather_pressure = $arr["main"]["pressure"];
$weather_humidity = $arr["main"]["humidity"];
$weather_speed = $arr["wind"]["speed"];
$weather_name = $arr["name"];
$weather_country = $arr["sys"]["country"];
$weather_sunrise = $arr["sys"]["sunrise"];
$weather_sunset = $arr["sys"]["sunset"];
echo '<p style="position: static;margin:0;">';
echo($weather_icon.'w_icon');
echo($weather_name.'w_name');
echo('Temp_'.intval($weather_temp).'_deg');
echo($weather_description.'_Description_');
echo('Press_'.$weather_pressure.'_hpascal');
echo('Wind_'.$weather_speed.'_m/s');
echo 'Sunrise:'.date( "H:m:s" , $weather_sunrise ).'';
echo 'Sunset:'.date( "H:m:s" , $weather_sunset ).'<b...
echo '</p>';
}
echo('Wind_'.$weather_speed.'_m/s');
echo 'Sunrise:'.date( "H:m:s" , $weather_sunrise ).'';
echo 'Sunset:'.date( "H:m:s" , $weather_sunset ).'<b...
echo '</p>';
}
?>
</body>
</html>?>
</body>
</html>
''&color(Red){以下工事中};''
ページ名: