function file_write($DEN) { global $argv, $power_company, $PowerCom_JP; $message = "現在の電力使用率 \n"; for ($i = 0; $i < 10; $i++) { $message .= $PowerCom_JP[$i] . $DEN[$power_company[$i]]["den_updown"] . $DEN[$power_company[$i]]["den_per"] . " \n"; } $message .= "#" . $argv[2]; return $message; } //----------------------------------------------------------------------------------- $DD = new Denryoku_Class(); $TT = new Twitter_Class(); $power_company = array("Hokkaido", "Tohoku", "Tokyo", "Chubu", "Hokuriku", "Kansai", "Chugoku", "Shikoku", "Kyushu", "Okinawa"); $PowerCom_JP = array("北海道電力", "東北電力 ", "東京電力 ", "中部電力 ", "北陸電力 ", "関西電力 ", "中国電力 ", "四国電力 ", "九州電力 ", "沖縄電力 "); $Power = $DD->StoreDenryoku(); for ($i = 0; $i < 10; $i++) { $DEN[$power_company[$i]] = $Power[$power_company[$i]]; } $Denryoku[] = array("ID" => 0, "dpercent" => $DEN["Hokkaido"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=575&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004669848"); $Denryoku[] = array("ID" => 1, "dpercent" => $DEN["Tohoku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=565&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004732726"); $Denryoku[] = array("ID" => 2, "dpercent" => $DEN["Tokyo"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=553&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004764737"); $Denryoku[] = array("ID" => 3, "dpercent" => $DEN["Chubu"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=572&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004795741"); $Denryoku[] = array("ID" => 4, "dpercent" => $DEN["Hokuriku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=577&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004825770"); $Denryoku[] = array("ID" => 5, "dpercent" => $DEN["Kansai"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=573&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004825777"); $Denryoku[] = array("ID" => 6, "dpercent" => $DEN["Chugoku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=578&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004919725"); $Denryoku[] = array("ID" => 7, "dpercent" => $DEN["Shikoku"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=576&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004950727"); $Denryoku[] = array("ID" => 8, "dpercent" => $DEN["Kyushu"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=574&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451004981736"); $Denryoku[] = array("ID" => 9, "dpercent" => $DEN["Okinawa"]["den_per"], "image" => "http://linuxparadise.moe.hm/zabbix/chart2.php?graphid=579&screenid=22&width=700&height=200&updateProfile=1&profileIdx=web.screens&profileIdx2=22&period=604800&stime=20161217081737&sid=43043aad777cc65e&curtime=1451005012737"); foreach ($Denryoku as $key => $value) { $ID[$key] = $value["ID"];
$message .= $setsuden; } else { $message .= $kansya; } } } $message .= "#" . $SHARP; return $message; } //----------------------------------------------------------------------------------- $TT = new Twitter_Class(); $DD = new Denryoku_Class(); $WW = new Weather_Class(); $wg = $WW->wunderground(); $power_company = array("Hokkaido", "Tohoku", "Tokyo", "Chubu", "Hokuriku", "Kansai", "Chugoku", "Shikoku", "Kyushu", "Okinawa"); $PP = $DD->StoreDenryoku(); for ($i = 0; $i < 10; $i++) { $Power[$power_company[$i]] = $PP[$power_company[$i]]; } if ($wg == NULL) { echo "ERROR"; exit; } $message = file_write(); //------------------------------------------------------------------- $status = $message; if (strstr($PLACE_NAME, "宮城県") || strstr($PLACE_NAME, "新潟県") || strstr($PLACE_NAME, "青森県")) { $image["Denryoku"] = $graph["Tohoku"]; } elseif (strstr($PLACE_NAME, "京都府") || strstr($PLACE_NAME, "奈良県") || strstr($PLACE_NAME, "兵庫県") || strstr($PLACE_NAME, "大阪府")) { $image["Denryoku"] = $graph["Kansai"]; } elseif (strstr($PLACE_NAME, "北海道")) {