***supermonの地域温度表示 [#g0286239]
AllstarLinkのコントロール画面(supermon)の初期地域温度表示は主に米国の
地域しか対応してないので、独自に日本国内対応に改変した。
+【概要】
 Webサーバ上に、wth.phpを作成する。 --- /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=mobara,jp&appid=b31f206a2ad51c9a39
 28e4ed36e0c0ac";
 $icon = '<img align="middle" style="width:45px;" src="http://openweathermap.org/img/w/';
 $k_temp = 273.15;
 $json = file_get_contents($url);
 $json = mb_convert_encoding($json, 'UTF8', 'ASCII,JIS,UTF-8,EUC-JP,SJIS-WIN');
 $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_temp;
     $weather_temp_max = $arr["main"]["temp_max"] - $k_temp;
     $weather_id = $arr["weather"][0]["id"];
     $weather_description = $arr["weather"][0]["description"];
     $weather_icon = $icon.$arr["weather"][0]["icon"].'.png">';
     $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 ).'<br>';
     echo '</p>';
 }
     echo('Wind_'.$weather_speed.'_m/s');
     echo 'Sunrise:'.date( "H:m:s" , $weather_sunrise ).'';
     echo 'Sunset:'.date( "H:m:s" , $weather_sunset ).'<br>';
     echo '</p>';
 }
 ?>
 </body>
 </html>?>
 </body>
 </html>

リロード   新規 下位ページ作成 凍結解除 差分 コピー 名前変更   ホーム 一覧 検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS