$image["MUNIN-UPTIME"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/uptime-week.png";
//------------------------------------------------------------------------
function file_write($server, $vista)
{
    $message = "Windows Vista サポート期限\n";
    $message .= "(2017年4月11日)残り▶\n";
    $message .= "【" . $vista["days"] . "(";
    $message .= $vista["m"] . $vista["d"] . $vista["h"] . $vista["i"];
    $message .= ")】 \n";
    $message .= "VPS連続稼働時間▶\n";
    $message .= "【" . $server . "】\n";
    $message .= "#Linux #LinuxMint #葛西臨海公園 ";
    return $message;
}
//-----------------------------------------------------------------------------------
$TT = new Twitter_Class();
$vista = $TT->rekijitsu(2017, 4, 12, 0, 1, 0);
$server = $TT->get_uptime();
if ($server == NULL || $vista == NULL) {
    echo "ERROR 1";
    exit;
} else {
    $message = file_write($server, $vista);
    $status = $message;
    //-------------------------------------------------------------------------
    $twitter = new tmhOauth(array("consumer_key" => $consumer_key, "consumer_secret" => $consumer_secret, "token" => $token, "secret" => $secret, "curl_ssl_verifypeer" => false));
    $c = 0;
    $media = count($image);
    $result_media_id = $TT->upload_image($twitter, $image);
    //	echo count($result_media_id);
    while (count($result_media_id) != $media && $c < 10) {
$image["MUNIN-WEEK"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/os-week.png";
$image["MUNIN-MONTH"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/os-month.png";
$image["MUNIN-UPTIME"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/uptime-week.png";
//------------------------------------------------------------------------
function file_write($vista)
{
    $message = "Windows Vista サポート期限\n";
    $message .= "2017年4月11日まで、残り\n";
    $message .= "【" . $vista["days"] . "】";
    $message .= "になりました。 \n";
    $message .= "Windows Vistaは楽しめましたか? \n";
    $message .= "#Linux #VPS #葛西臨海公園 \n";
    return $message;
}
//-----------------------------------------------------------------------------------
$TT = new Twitter_Class();
$vista = $TT->rekijitsu(2017, 4, 12, 0, 1, 0);
if ($vista == NULL) {
    echo "ERROR 1";
    exit;
} else {
    $message = file_write($vista);
    $status = $message;
    //-------------------------------------------------------------------------
    $twitter = new tmhOauth(array("consumer_key" => $consumer_key, "consumer_secret" => $consumer_secret, "token" => $token, "secret" => $secret, "curl_ssl_verifypeer" => false));
    $c = 0;
    $media = count($image);
    $result_media_id = $TT->upload_image($twitter, $image);
    //	echo count($result_media_id);
    while (count($result_media_id) != $media && $c < 10) {
        $result_media_id = $TT->upload_image($twitter, $image);
<?php

/*
	author:Kouji Sugibayashi
*/
require_once '/home/kouji/public_html/html/AutoTweet/TanpopoWeather.php';
$TT = new Twitter_Class();
$vista = $TT->rekijitsu(2017, 4, 12, 0, 1, 0);
if ($vista == NULL) {
    echo "ERROR";
    exit;
} else {
    $img = ImageCreateFromJPEG("/home/kouji/public_html/html/AutoTweet/image/322.jpg");
    # 必要に応じてUTF8へ変換(環境依存)
    $nokori = mb_convert_encoding("残り日数", 'UTF-8', 'auto');
    $nokori_day = mb_convert_encoding("【" . $vista["days"] . "】", 'UTF-8', 'auto');
    $Vista_days = mb_convert_encoding("(" . $vista["y"] . $vista["m"] . $vista["d"] . $vista["h"] . $vista["i"] . ")", 'UTF-8', 'auto');
    $font = "/usr/share/fonts/truetype/vlgothic/VL-PGothic-Regular.ttf";
    # 白い文字を書き込む
    $blue = ImageColorAllocate($img, 0x44, 0x44, 0xff);
    $green = ImageColorAllocate($img, 0x22, 0x88, 0x22);
    $ash = ImageColorAllocate($img, 0x30, 0x30, 0x30);
    $white = ImageColorAllocate($img, 0xff, 0xff, 0xff);
    $cyan = ImageColorAllocate($img, 0xff, 0x88, 0xff);
    ImageTTFText($img, 80, 0, 805, 355, $blue, $font, $nokori);
    ImageTTFText($img, 80, 0, 800, 350, $white, $font, $nokori);
    ImageTTFText($img, 200, 0, 380, 610, $green, $font, $nokori_day);
    ImageTTFText($img, 200, 0, 370, 600, $white, $font, $nokori_day);
    ImageTTFText($img, 60, 0, 485, 735, $cyan, $font, $Vista_days);
    ImageTTFText($img, 60, 0, 480, 730, $white, $font, $Vista_days);
    header('Content-Type: image/jpeg');
*/
require_once 'TanpopoWeather.php';
//------------------------------------------------------------------------
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");
$image["MUNIN-UPTIME"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/uptime-week.png";
//------------------------------------------------------------------------
function file_write($server, $win7)
{
    $message = "Windows 7 サポート期限\n";
    $message .= "(2020年1月14日)残り▶\n";
    $message .= "【" . $win7["days"] . "(";
    $message .= $win7["y"] . $win7["m"] . $win7["d"] . $win7["h"] . $win7["i"];
    $message .= ")】 \n";
    $message .= "VPS連続稼働時間▶\n";
    $message .= "【" . $server . "】\n";
    $message .= "#Linux #LinuxMint #葛西臨海公園";
    return $message;
}
//-----------------------------------------------------------------------------------
$TT = new Twitter_Class();
$win7 = $TT->rekijitsu(2020, 1, 15, 0, 1, 0);
$server = $TT->get_uptime();
if ($server == NULL || $win7 == NULL) {
    echo "ERROR 1";
    exit;
} else {
    $message = file_write($server, $win7);
    $status = $message;
    //-------------------------------------------------------------------------
    $twitter = new tmhOauth(array("consumer_key" => $consumer_key, "consumer_secret" => $consumer_secret, "token" => $token, "secret" => $secret, "curl_ssl_verifypeer" => false));
    $c = 0;
    $media = count($image);
    $result_media_id = $TT->upload_image($twitter, $image);
    //	echo count($result_media_id);
    while (count($result_media_id) != $media && $c < 10) {
<?php

/*
	author: Kouji Sugibayashi
*/
require_once '/home/kouji/public_html/html/AutoTweet/TanpopoWeather.php';
$TT = new Twitter_Class();
$win7 = $TT->rekijitsu(2020, 1, 15, 0, 1, 0);
if ($win7 == NULL) {
    echo "ERROR";
    exit;
} else {
    $img = ImageCreateFromJPEG("/home/kouji/public_html/html/AutoTweet/image/324.jpg");
    # 必要に応じてUTF8へ変換(環境依存)
    $nokori = mb_convert_encoding("残り日数", 'UTF-8', 'auto');
    $nokori_day = mb_convert_encoding("【" . $win7["days"] . "】", 'UTF-8', 'auto');
    $Win7_days = mb_convert_encoding("(" . $win7["y"] . $win7["m"] . $win7["d"] . $win7["h"] . $win7["i"] . ")", 'UTF-8', 'auto');
    $font = "/usr/share/fonts/truetype/vlgothic/VL-PGothic-Regular.ttf";
    $blue = ImageColorAllocate($img, 0x44, 0x44, 0xff);
    $green = ImageColorAllocate($img, 0x22, 0x88, 0x22);
    $ash = ImageColorAllocate($img, 0x30, 0x30, 0x30);
    $white = ImageColorAllocate($img, 0xff, 0xff, 0xff);
    $cyan = ImageColorAllocate($img, 0xff, 0x88, 0xff);
    ImageTTFText($img, 80, 0, 805, 355, $blue, $font, $nokori);
    ImageTTFText($img, 80, 0, 800, 350, $white, $font, $nokori);
    ImageTTFText($img, 200, 0, 300, 610, $green, $font, $nokori_day);
    ImageTTFText($img, 200, 0, 290, 600, $white, $font, $nokori_day);
    ImageTTFText($img, 60, 0, 485, 735, $cyan, $font, $Win7_days);
    ImageTTFText($img, 60, 0, 480, 730, $white, $font, $Win7_days);
    header('Content-Type: image/jpeg');
    ImageJPEG($img);
Example #7
0
#!/usr/bin/php
<?php 
require_once "/home/kouji/public_html/html/AutoTweet/TanpopoWeather.php";
function file_write()
{
    extract($GLOBALS);
    $dom = new DomDocument('1.0', 'UTF-8');
    $prefs = $dom->appendChild($dom->createElement('prefs'));
    $pref = $prefs->appendChild($dom->createElement('pref'));
    $pref->setAttribute('code', 'WinOS');
    $pref->appendChild($dom->createElement('Vista', sprintf("%d", $Vista)));
    $pref->appendChild($dom->createElement('Win7', sprintf("%d", $Win7)));
    $weekjp = array('日', '月', '火', '水', '木', '金', '土');
    $weekno = date('w');
    $week_X = "〔" . $weekjp[$weekno] . "〕";
    $pref = $prefs->appendChild($dom->createElement('pref'));
    $pref->setAttribute('code', 'DATE');
    $pref->appendChild($dom->createElement('time', date("Y年m月j日") . $week_X . date(" H時i分")));
    $pref->appendChild($dom->createElement('time_ampm', date("Y年m月j日") . $week_X . date(" A h:i")));
    $dom->formatOutput = true;
    $save_file = "/etc/zabbix/externalscripts/" . $OUT_FILE;
    $dom->save($save_file);
}
//---------------------------------------------------------------------------------------
$OUT_FILE = "WinOS_prefs.xml";
echo "OUT_FILE=" . $OUT_FILE . "\nで出力します。\n";
$TT = new Twitter_Class();
$Vista = $TT->rekijitsu_2(2017, 4, 12, 00, 00, 00);
$Win7 = $TT->rekijitsu_2(2020, 1, 15, 00, 00, 00);
file_write();
<?php

/*
	author:Kouji Sugibayashi
*/
require_once '/home/kouji/public_html/html/AutoTweet/TanpopoWeather.php';
$TT = new Twitter_Class();
function youbi_japan()
{
    //日本語の曜日配列
    $weekjp = array('日', '月', '火', '水', '木', '金', '土');
    //現在の曜日番号(日:0  月:1  火:2  水:3  木:4  金:5  土:6)を取得
    $weekno = date('w');
    //日本語曜日を出力
    return $weekjp[$weekno];
}
$win10 = $TT->rekijitsu(2025, 10, 15, 0, 1, 0);
$win8 = $TT->rekijitsu(2023, 1, 11, 0, 1, 0);
$win7 = $TT->rekijitsu(2020, 1, 15, 0, 1, 0);
$vista = $TT->rekijitsu(2017, 4, 12, 0, 1, 0);
if ($vista == NULL || $win7 == NULL) {
    echo "ERROR";
    exit;
} else {
    $img = ImageCreateFromJPEG("/home/kouji/public_html/html/AutoTweet/image/337.jpg");
    $title_txt = mb_convert_encoding("Microsoft Windows サポート期間\n" . date("Y年m月d日〔" . youbi_japan() . "〕 H時i分 現在"), 'UTF-8', 'auto');
    $Win10_txt = mb_convert_encoding("Windows 10 サポート 残り日数", "UTF-8", "auto");
    $Win10_txt2 = mb_convert_encoding("2025年10月14日まで、\n【" . $win10["days"] . "】\n(" . $win10["y"] . $win10["m"] . $win10["d"] . $win10["h"] . $win10["i"] . ")", 'UTF-8', 'auto');
    $Win8_txt = mb_convert_encoding("Windows 8.1 サポート 残り日数", "UTF-8", "auto");
    $Win8_txt2 = mb_convert_encoding("2023年01月10日まで、\n【" . $win8["days"] . "】\n(" . $win8["y"] . $win8["m"] . $win8["d"] . $win8["h"] . $win8["i"] . ")", 'UTF-8', 'auto');
    $Win7_txt = mb_convert_encoding("Windows 7 サポート 残り日数", "UTF-8", "auto");
$image["MUNIN-WEEK"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/os-week.png";
$image["MUNIN-MONTH"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/os-month.png";
$image["MUNIN-UPTIME"] = "http://thanks.moe.hm/munin/localdomain/localhost.localdomain/uptime-week.png";
//------------------------------------------------------------------------
function file_write($win7)
{
    $message = "Windows 7 サポート期限\n";
    $message .= "2020年1月14日まで、残り\n";
    $message .= "【" . $win7["days"] . "】";
    $message .= "になりました。 \n";
    $message .= "Windows 7は、楽しいですか? \n";
    $message .= "#Linux #VPS #葛西臨海公園 \n";
    return $message;
}
//-----------------------------------------------------------------------------------
$TT = new Twitter_Class();
$win7 = $TT->rekijitsu(2020, 1, 15, 0, 1, 0);
if ($win7 == NULL) {
    echo "ERROR 1";
    exit;
} else {
    $message = file_write($win7);
    $status = $message;
    //-------------------------------------------------------------------------
    $twitter = new tmhOauth(array("consumer_key" => $consumer_key, "consumer_secret" => $consumer_secret, "token" => $token, "secret" => $secret, "curl_ssl_verifypeer" => false));
    $c = 0;
    $media = count($image);
    $result_media_id = $TT->upload_image($twitter, $image);
    //	echo count($result_media_id);
    while (count($result_media_id) != $media && $c < 10) {
        $result_media_id = $TT->upload_image($twitter, $image);
    } else {
        $message_time = "じゃない";
    }
    $message = "ミントの時間" . $message_time . "です! \n";
    $message .= "東京都心▶\n";
    $message .= "天気:" . $wg["weather"] . " \n";
    $message .= "気温:" . $wg["temp_now2"] . "℃ \n";
    $message .= "湿度:" . $wg["humidity_now2"] . " \n";
    $message .= "不快指数:" . $wg["fukai"] . " \n";
    $message .= "サーバー連続稼働時間▶\n";
    $message .= $hozon . " \n";
    $message .= "Linux Mintは今日も元気!\n";
    return $message;
}
//-------------------------------------------------------------------------
$TT = new Twitter_Class();
$WW = new Weather_Class();
$hozon = $TT->get_uptime();
$wg = $WW->wunderground();
if ($hozon == NULL || $wg == NULL) {
    echo "ERROR 1";
    exit;
} else {
    $message = file_write($wg, $hozon);
    //-------------------------------------------------------------------------
    $image["weather_icon"] = $wg["icon_url"];
    if ($wg["icon_url"] == NULL) {
        unset($image["weather_icon"]);
    }
    if ($message_time == "PM 3:10") {
        $image["Mint"] = $image_pm;