📄 umcsendsms.php
字号:
<?php//// Copyright (c) 2005 Vladislav Lazarenko//// This file is part of SMS Man project.//// SMS Man is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// SMS Man is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with SMS Man; if not, write to the Free Software// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USArequire_once('HTTP/Client.php');require_once('HTTP/Request/Listener.php');class UMC_SMS_Sender{ var $_umc_url = "http://www.umc.ua"; var $_send_page = "/back/modules/sms/db_sms.php"; var $_umc_codepic_url = "/back/modules/sms/sms_picture.php"; var $_http_client; var $_session_id = ""; var $_image_file = "tmp/UMC_Code.gif"; var $_pnm_file = "tmp/UMC_Code.pnm"; var $_umc_code = ""; function UMC_SMS_Sender() { $this->_http_client = &new HTTP_Client(); } function sendSMS($number, $message, $sender) { $this->_http_client->reset(); $this->_getSessionID(); $this->_savePicture(); $this->_gifToPnm(); $this->_recognizeCode(); $data = array( 'PHPSESSID' => $this->_session_id, 'script' => '/ukr/sendsms.php', 'sms_tag_id' => '1', 'network1' => "UMC", 'phone1' => $number, 'network2' => "UMC", 'phone2' => "", 'network3' => "UMC", 'phone3' => "", 'message' => $message, 'translit' => '1', 'anti' => $this->_umc_code, 'sender_name' => $sender ); $this->_http_client->post( $this->_umc_url."/back/modules/sms/db_sms.php", $data); $this->_http_client->reset(); } function &_getSessionID() { // Start page for SMS sending. Give us session id. $page = "/ukr/sendsms.php"; // Getting start page. $this->_http_client->get($this->_umc_url.$page); // Remember response. $responce = $this->_http_client->currentResponse(); // Example of URL link for picture. // <img src="/back/modules/sms/sms_picture.php?PHPSESSID=c4fc52ab00349024d0632efcc176a4ff" width="52" height="20" border="0" alt=""> // Search for image url to get session id. preg_match("<img src=\"".$this->_umc_codepic_url."\?PHPSESSID=(.*)\" width=\"52\" height=\"20\" border=\"0\" alt=\"\">", $responce['body'], $out); // Remember session id. $this->_session_id = $out[1]; // Just for debug purpose. echo "Session ID: ".$this->_session_id."\n"; } function &_savePicture() { // URL to get image with anti-bot code :-) $pic_url = $this->_umc_url.$this->_umc_codepic_url."?PHPSESSID=".$this->_session_id; // Getting picture. $this->_http_client->get($pic_url); // Remember response. $response = $this->_http_client->currentResponse(); // Create image from response. $image = imagecreatefromstring($response['body']); // I've only GIF to PNM converter, so, convert image to GIF first and save it. imagegif($image, $this->_image_file); // Free memory. imagedestroy($image); } function &_gifToPnm() { exec("giftopnm ".$this->_image_file." > ".$this->_pnm_file); } function &_recognizeCode() { $this->_umc_code = exec("gocr -C \"0123456789\" -i ".$this->_pnm_file); echo "Anti-bot code: ".$this->_umc_code."\n"; }}//$sender = &new UMC_SMS_Sender();//$sender->sendSMS("DDDDDDD", "Hello!", "Sender");?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -