SDUT宿舍电量查询

效果

链接>>cloud.aikamino.cn/power/?b=12&r=101

格式:cloud.aikamino.cn/power/?b={宿舍楼号}&r={房间号}

《SDUT宿舍电量查询》

注意:建议去后勤服务平台查询,此系统兼容性太差,12#可用,其它的应该不可以。

原理

  • PHP curl
  • simple-html-dom类
  • smtp类
  • 定时任务

代码

functions.php

<?php
/**
 * Author: kamino
 * Time: 2017/11/25,下午 03:07
 * Description: 电量通知
 */
class powerNotice
{
    function getData($build, $room) {
        $name = ""; //YOUR NAME
        $id = 000; //YOUR SCHOOL NUMBER
        $url_get = "http://hqfw.sdut.edu.cn/stu_elc.aspx";
        $url_login = "http://hqfw.sdut.edu.cn/login.aspx";
        $value = "__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=%2FwEPDwUJMzc5MTg1NjY3D2QWAmYPZBYCAgMPZBYEAgEPDxYCHgRUZXh0BSVb5qyi6L%2BO5oKoLOadjuivl%2BaZqOWQjOWtpiAgfCDpgIDlh7pdZGQCBw9kFggCAQ8QZGQWAWZkAgUPEGRkFgFmZAILDxAPFgQeB0NoZWNrZWRoHwAFDOe7keWumuaIv%2BmXtGRkZGQCFQ9kFgQCBg88KwARAwAPFgQeC18hRGF0YUJvdW5kZx4LXyFJdGVtQ291bnQCCmQBEBYAFgAWAAwUKwAAFgJmD2QWFgIBD2QWCmYPZBYCZg8VAQExZAIBDw8WAh8ABQYxOCMxMDZkZAICDw8WBB8ABQszMeWIhumSn%2BWJjR4HVG9vbFRpcAUTMjAxNy8xMS8yMSAyMDozOTozMmRkAgMPZBYCAgEPDxYCHwAFBDQuODdkZAIED2QWAgIBDw8WAh8ABQQwLjA4ZGQCAg9kFgpmD2QWAmYPFQEBMmQCAQ8PFgIfAAUGMjEjNDIzZGQCAg8PFgQfAAULMzDliIbpkp%2FliY0fBAUTMjAxNy8xMS8yMSAyMDo0MDoxN2RkAgMPZBYCAgEPDxYCHwAFBDEuNDJkZAIED2QWAgIBDw8WAh8ABQQ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oVogxM0altVdQZzu2cA9mCgGge081ra3ljoDNzmoR2eHyIFGGgg5comRL9ECiNhl%2BQcyVFoqkqxbN%2Fh0R7O5Y4jRxka2HRC2%2FBm8O5hvSkz%2B3%2F7teUrFGGruVA16U4IxiXD0MuyTogL4o2H4TLmz55OmpVxnnpStxTji7yTI2xKgy3dEg9mNeGnHGZ6iqM%2B%2BBWSM%2BkhnRlgD%2FL44CTM8hK9Q00FKhSC4JO3VjlhD%2BGDqRsBVN5y%2BID52W%2Boqh%2Bd3fBy3LDDz0lsNt4u%2BCuCFpchChcSzuXJPhejNDg4j4D7kDH0cnenZLRSzXAAndEQNyFO%2BeN4ywqcSOugWXFA%3D%3D&ctl00%24MainContent%24campus=1&ctl00%24MainContent%24buildingwest=" . $build . "%23&ctl00%24MainContent%24roomnumber=" . $room . "&ctl00%24MainContent%24Button1=%E6%9F%A5%E8%AF%A2&ctl00%24MainContent%24TextBox1=%E8%AF%B7%E5%85%88%E7%99%BB%E5%BD%95%EF%BC%8C%E5%86%8D%E9%80%89%E6%8B%A9%E6%A5%BC%E6%A0%8B%E5%92%8C%E8%BE%93%E5%85%A5%E6%88%BF%E9%97%B4%E5%8F%B7%E6%9F%A5%E8%AF%A2%21";
        $loginme = "__VIEWSTATE=%2FwEPDwULLTE0MjEyNjEzNTAPZBYCZg9kFgICAw9kFgICAQ8PFgIeBFRleHQFJFvmrKLov47mgqgs5p2O6K%2BX5pmo5ZCM5a2mIHwg6YCA5Ye6XWRkZL0zwWiW6Ox7Lh7yaYREnQapTw5pVjTzdH2kZQJkXjit&__EVENTVALIDATION=%2FwEdAAUJvXfXR46xefKvYQlvlHiB0bw7OTl0Nda6He34GqZ58kgUhvz8rrcu%2BzNJ%2BwchXtuKlKSxZ0KpyD3gp9GSlDi4QX9%2BScDGDIM47zqhQCjs5W02wAnnb9dfO8JVgQn%2BYcXj0Xjy%2BDTO2XvQrVPqQIoO&ctl00%24MainContent%24txtName=" . $name . "&ctl00%24MainContent%24txtID=" . $id . "&ctl00%24MainContent%24btnTijiao=%E7%99%BB%E5%BD%95";
        $cookie_file = tempnam("./temp", "cookie");

        $login = curl_init();
        curl_setopt($login, CURLOPT_URL, $url_login);
        curl_setopt($login, CURLOPT_HEADER, 0);
        curl_setopt($login, CURLOPT_COOKIEJAR, $cookie_file);
        curl_setopt($login, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($login, CURLOPT_POST, 1);
        curl_setopt($login, CURLOPT_POSTFIELDS, $loginme);
        curl_exec($login);
        curl_close($login);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url_get);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $value);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
        $data = curl_exec($ch);
        curl_close($ch);

        return $data;
    }

    public function match($data) {
        $a = "/\d{2}+#+\d{3}/";
        $b = "/\d{4}+\/+\d{2}+\/+\d{2}/";
        $c = "/\d{2}+\:+\d{2}+\:+\d{2}/";
        $d = "/\d{1,4}+\.+\d{2}/";
        $e = "/\d{1,3}+\ \-\ +\d{1,3}/";
        preg_match($a, $data, $ai);
        $re[0] = $ai[0];
        preg_match($b, $data, $bi);
        $re[1] = $bi[0];
        preg_match($c, $data, $ci);
        $re[2] = $ci[0];
        preg_match($d, $data, $di);
        $re[3] = $di[0];
        preg_match($e, $data, $ei);
        $re[4] = $ei[0];

        return $re;
    }

    function echoHtml($arr) {
        $data = '<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#F4F3F4"><tbody><tr><td style="padding:15px"><center><table width="550" cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff"><tbody><tr><td align="left"><div style="border:solid 1px #d9d9d9"><table id="header" style="line-height:1.6;font-size:12px;font-family:Helvetica,Arial,sans-serif;border:solid 1px #FFF;color:#444" border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#ffffff"><tbody><tr><td style="color:#fff" colspan="2" valign="bottom" height="30">.</td></tr><tr><td style="line-height:32px;padding-left:30px" valign="baseline"><span style="font-size:32px">剩余电量:<font color="red">' . $arr[3] . '</font>度</span></td><td style="padding-right:30px" align="right" valign="baseline"><span style="font-size:14px;color:#777"><a style="text-decoration:none;color:#777" href="https://aikamino.cn" target="_blank">AIKAMINO.CN</a></span></td></tr></tbody></table><table id="content" style="margin-top:15px;margin-right:30px;margin-left:30px;color:#444;line-height:1.6;font-size:12px;font-family:Arial,sans-serif" border="0" width="490" cellspacing="0" cellpadding="0" bgcolor="#ffffff"><tbody><tr><td style="border-top:solid 1px #d9d9d9" colspan="2"><div style="padding:15px 0"><table><tr><td style="width:100px">宿舍</td><td style="width:200px">' . $arr[0] . '</td></tr><tr><td style="width:100px">查询时间</td><td style="width:200px">' . $arr[1] . '&nbsp;' . $arr[2] . '</td></tr><tr><td style="width:100px">剩余电量可用</td><td style="width:200px">' . $arr[4] . '天</td></tr></table></div></td></tr></tbody></table><table id="footer" style="line-height:1.5;font-size:12px;font-family:Arial,sans-serif;margin-right:30px;margin-left:30px" border="0" width="490" cellspacing="0" cellpadding="0" bgcolor="#ffffff"><tbody><tr style="font-size:11px;color:#999"><td style="border-top:solid 1px #d9d9d9" colspan="2"><div>如果有任何问题,请联系 <a href="mailto:kamino@imea.me" style="text-decoration:none;color:grey">kamino@imea.me</a></div></td></tr><tr><td style="color:#fff" colspan="2" height="15">.</td></tr></tbody></table></div></td></tr></tbody></table></center></td></tr></tbody></table>';
        return $data;
    }

    function getHtml($build, $room) {
        $get = $this->getData($build, $room);
        require("simple_html_dom.php");
        $html = new simple_html_dom();
        $html->load($get);
        $re = $html->find("textarea", 0);
        $power = $re->innertext;

        $arr = $this->match($power);
        $send = $this->echoHtml($arr);

        return $send;
    }

    function saveLog($text) {
        $log = fopen("log.html", "a");
        $time = date("Y-m-d H:m");
        $con = "<p>===============</p><p>" . $time . "</p>" . $text . "<P>===============</P>\r\n";
        fwrite($log, $con);
        fclose($log);
    }

    public function sendMail($mailto, $data) {
        require_once("smtp.php");
        define("SMTP_SERVER", "ssl://smtp.qq.com");
        define("SMTP_PORT", 465);
        define("SMTP_ACCOUNT", ""); //SMTP ACCOUNT
        define("SMTP_PASSWD", ""); //SMTP PASSWORD
        define("SMTP_SUBJECT", "=?UTF-8?B?" . base64_encode("电量通知") . "?=");
        define("SMTP_MAILTO", $mailto);
        define("SMTP_MESSAGE", $data);
        define("SMTP_TYPE", "HTML");
        define("SMTP_FROM", "AIKAMINO");

        $smtp = new smtp(SMTP_SERVER, SMTP_PORT, true, SMTP_ACCOUNT, SMTP_PASSWD);
        $smtp->debug = TRUE;
        $this->saveLog("<p>TO: " . SMTP_MAILTO . "</p>" . SMTP_MESSAGE);
        $smtp->sendmail(SMTP_MAILTO, SMTP_ACCOUNT, SMTP_SUBJECT, SMTP_MESSAGE, SMTP_TYPE);
        $smtp->close();
    }

    function newProject($build, $room, $mailto) {
        $mail = $this->getHtml($build, $room);
        $this->sendMail($mailto, $mail);
        return 1;
    }
}

index.php

<?php
/**
 * Author: kamino
 * Time: 2017/11/25,下午 09:55
 * Description: 网页访问
 */

$build = $_GET["b"];
$room = $_GET["r"];

if (empty($build)) {
    $build = 12;
}
if (empty($room)) {
    $room = 101;
}

require_once("functions.php");
$a = new powerNotice();
echo $a->getHtml($build, $room);

do.php

<?php
require("functions.php");
$do = new powerNotice();
$do->newProject($build, $room, $email);
?>

run.bat //定时任务

php do.php

simple_html_dom.php

https://github.com/samacs/simple_html_dom

smtp.php //来自不知名的大佬

<?php
/**
 * Author: not kamino
 * Time: 2017/11/25,下午 03:42
 * Description: smtp发送邮件通知
 */
class smtp
{
    /* Public Variables */
    var $smtp_port;
    var $time_out;
    var $host_name;
    var $log_file;
    var $relay_host;
    var $debug;
    var $auth;
    var $user;
    var $pass;

    /* Private Variables */
    var $sock;

    /* Constractor */
    function smtp($relay_host = "", $smtp_port = 25, $auth = false, $user, $pass) {
        $this->debug = FALSE;
        $this->smtp_port = $smtp_port;
        $this->relay_host = $relay_host;
        $this->time_out = 30; //is used in fsockopen()
        $this->auth = $auth;//auth
        $this->user = $user;
        $this->pass = $pass;
        $this->host_name = "localhost"; //is used in HELO command
        $this->log_file = "";
        $this->sock = FALSE;
    }

    /* Main Function */
    function sendmail($to, $from, $subject = "", $body = "", $mailtype, $cc = "", $bcc = "", $additional_headers = "") {
        $mail_from = $this->get_address($this->strip_comment($from));
        $body = preg_replace("/(^|(\r\n))(\.)/", "\1.\3", $body);
        $header = "MIME-Version:1.0\r\n";
        if ($mailtype == "HTML") {
            $header .= "Content-Type:text/html; charset=utf-8\r\n";
        }
        $header .= "To: " . $to . "\r\n";
        if ($cc != "") {
            $header .= "Cc: " . $cc . "\r\n";
        }
        $header .= "From: $from<" . $from . ">\r\n";
        $header .= "Subject: " . $subject . "\r\n";
        $header .= $additional_headers;
        $header .= "Date: " . date("r") . "\r\n";
        $header .= "X-Mailer:By Redhat (PHP/" . phpversion() . ")\r\n";
        list($msec, $sec) = explode(" ", microtime());
        $header .= "Message-ID: <" . date("YmdHis", $sec) . "." . ($msec * 1000000) . "." . $mail_from . ">\r\n";
        $TO = explode(",", $this->strip_comment($to));

        if ($cc != "") {
            $TO = array_merge($TO, explode(",", $this->strip_comment($cc)));
        }
        if ($bcc != "") {
            $TO = array_merge($TO, explode(",", $this->strip_comment($bcc)));
        }
        $sent = TRUE;
        foreach ($TO as $rcpt_to) {
            $rcpt_to = $this->get_address($rcpt_to);
            if (!$this->smtp_sockopen($rcpt_to)) {
                $this->log_write("Error: Cannot send email to " . $rcpt_to . "\n");
                $sent = FALSE;
                continue;
            }
            if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $header, $body)) {
                $this->log_write("E-mail has been sent to <" . $rcpt_to . ">\n");
            } else {
                $this->log_write("Error: Cannot send email to <" . $rcpt_to . ">\n");
                $sent = FALSE;
            }
            fclose($this->sock);
            $this->log_write("Disconnected from remote host\n");
        }
        return $sent;
    }

    /* Private Functions */
    function smtp_send($helo, $from, $to, $header, $body = "") {
        if (!$this->smtp_putcmd("HELO", $helo)) {
            return $this->smtp_error("sending HELO command");
        }

        #auth
        if ($this->auth) {
            if (!$this->smtp_putcmd("AUTH LOGIN", base64_encode($this->user))) {
                return $this->smtp_error("sending HELO command");
            }
            if (!$this->smtp_putcmd("", base64_encode($this->pass))) {
                return $this->smtp_error("sending HELO command");
            }
        }
        if (!$this->smtp_putcmd("MAIL", "FROM:<" . $from . ">")) {
            return $this->smtp_error("sending MAIL FROM command");
        }
        if (!$this->smtp_putcmd("RCPT", "TO:<" . $to . ">")) {
            return $this->smtp_error("sending RCPT TO command");
        }
        if (!$this->smtp_putcmd("DATA")) {
            return $this->smtp_error("sending DATA command");
        }
        if (!$this->smtp_message($header, $body)) {
            return $this->smtp_error("sending message");
        }
        if (!$this->smtp_eom()) {
            return $this->smtp_error("sending <CR><LF>.<CR><LF> [EOM]");
        }
        if (!$this->smtp_putcmd("QUIT")) {
            return $this->smtp_error("sending QUIT command");
        }
        return TRUE;
    }

    function smtp_sockopen($address) {
        if ($this->relay_host == "") {
            return $this->smtp_sockopen_mx($address);
        } else {
            return $this->smtp_sockopen_relay();
        }
    }

    function smtp_sockopen_relay() {
        $this->log_write("Trying to " . $this->relay_host . ":" . $this->smtp_port . "\n");
        $this->sock = @fsockopen($this->relay_host, $this->smtp_port, $errno, $errstr, $this->time_out);
        if (!($this->sock && $this->smtp_ok())) {
            $this->log_write("Error: Cannot connenct to relay host " . $this->relay_host . "\n");
            $this->log_write("Error: " . $errstr . " (" . $errno . ")\n");
            return FALSE;
        }
        $this->log_write("Connected to relay host " . $this->relay_host . "\n");
        return TRUE;;
    }

    function smtp_sockopen_mx($address) {
        $domain = preg_replace("^.+@([^@]+)$", "\1", $address);
        if (!@getmxrr($domain, $MXHOSTS)) {
            $this->log_write("Error: Cannot resolve MX \"" . $domain . "\"\n");
            return FALSE;
        }
        foreach ($MXHOSTS as $host) {
            $this->log_write("Trying to " . $host . ":" . $this->smtp_port . "\n");
            $this->sock = @fsockopen($host, $this->smtp_port, $errno, $errstr, $this->time_out);
            if (!($this->sock && $this->smtp_ok())) {
                $this->log_write("Warning: Cannot connect to mx host " . $host . "\n");
                $this->log_write("Error: " . $errstr . " (" . $errno . ")\n");
                continue;
            }
            $this->log_write("Connected to mx host " . $host . "\n");
            return TRUE;
        }
        $this->log_write("Error: Cannot connect to any mx hosts (" . implode(", ", $MXHOSTS) . ")\n");
        return FALSE;
    }

    function smtp_message($header, $body) {
        fputs($this->sock, $header . "\r\n" . $body);
        $this->smtp_debug("> " . str_replace("\r\n", "\n" . "> ", $header . "\n> " . $body . "\n> "));
        return TRUE;
    }

    function smtp_eom() {
        fputs($this->sock, "\r\n.\r\n");
        $this->smtp_debug(". [EOM]\n");
        return $this->smtp_ok();
    }

    function smtp_ok() {
        $response = str_replace("\r\n", "", fgets($this->sock, 512));
        $this->smtp_debug($response . "\n");
        if (!preg_match("/^[23]/", $response)) {
            fputs($this->sock, "QUIT\r\n");
            fgets($this->sock, 512);
            $this->log_write("Error: Remote host returned \"" . $response . "\"\n");
            return FALSE;
        }
        return TRUE;
    }

    function smtp_putcmd($cmd, $arg = "") {
        if ($arg != "") {
            if ($cmd == "") {
                $cmd = $arg;
            } else {
                $cmd = $cmd . " " . $arg;
            }
        }
        fputs($this->sock, $cmd . "\r\n");
        $this->smtp_debug("> " . $cmd . "\n");
        return $this->smtp_ok();
    }

    function smtp_error($string) {
        $this->log_write("Error: Error occurred while " . $string . ".\n");
        return FALSE;
    }

    function log_write($message) {
        $this->smtp_debug($message);
        if ($this->log_file == "") {
            return TRUE;
        }
        $message = date("M d H:i:s ") . get_current_user() . "[" . getmypid() . "]: " . $message;
        if (!@file_exists($this->log_file) || !($fp = @fopen($this->log_file, "a"))) {
            $this->smtp_debug("Warning: Cannot open log file \"" . $this->log_file . "\"\n");
            return FALSE;;
        }
        flock($fp, LOCK_EX);
        fputs($fp, $message);
        fclose($fp);
        return TRUE;
    }

    function strip_comment($address) {
        $comment = "/\([^()]*\)/";
        while (preg_match($comment, $address)) {
            $address = preg_replace($comment, "", $address);
        }
        return $address;
    }

    function get_address($address) {
        $address = preg_replace("/([ \t\r\n])+/", "", $address);
        $address = preg_replace("/^.*<(.+)>.*$/", "\1", $address);
        return $address;
    }

    function smtp_debug($message) {
        if ($this->debug) {
            echo $message;
        }
    }


}

?>

 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注