Пример #1
0
    function manage_action() {
        if(!config::get('sms_username') || !config::get('sms_password')){
            echo '<script>alert("您需要先设置用户名和密码才能使用短信管理功能!");window.location.href="'.url('config/system/set/sms').'";</script>';
            exit;
        }
        include_once("phprpc/phprpc_client.php");
        $client = new PHPRPC_Client();
        $client->setProxy(NULL);
        $client->useService('http://pay.cmseasy.cn/sms.php');
        $client->setKeyLength(128);
        $client->setEncryptMode(3);
        $info = $client->getInfo(config::get('sms_username'),md5(config::get('sms_password')));
        $info[0] = intval($info[0]);
        $info[1] = intval($info[1]);
        $this->view->info = $info;
        if (front::post('submit')) {
            if (front::post('act') == 'test') {
                $rs = sendMsg(front::post('mobile'),'test');
                if($rs->SendSMSResult == '0'){
                    front::flash('发送成功');
                }else{
                    front::flash('发送失败,请检查用户名、密码或剩余条数');
                }
            }
        }else{
			if($info[0] < 50) front::flash('你的剩余短信不足50条,请及时充值');
		}
    }
Пример #2
0
#!/usr/bin/env php
<?php 
if ($argc < 2) {
    echo "Usage: {$argv['0']} <url> [POST data]\n";
    die;
}
$url = $argv[1];
$params = array();
if (isset($argv[2])) {
    parse_str($argv[2], $params);
}
require_once dirname(__FILE__) . '/phprpc/phprpc_client.php';
$client = new PHPRPC_Client();
$client->setProxy(NULL);
$client->useService($url);
$client->setKeyLength(1000);
$client->setEncryptMode(3);
$client->setCharset('UTF-8');
$client->setTimeout(10);
var_dump($client->response(json_encode($params)));
Пример #3
0
function sendMsg($mobile, $content) {
    $tc = file_get_contents('config/sms.tmp.php');
    $tmp = explode('@', $tc);
    if ($tmp[0] >= config::get('sms_maxnum') && $tmp[1] == date('Y-m-d')) {
    	front::flash('发送失败,请检查用户名、密码或剩余条数');
        return;
    }
    include_once("phprpc/phprpc_client.php");
    $client = new PHPRPC_Client();
    $client->setProxy(NULL);
    $client->useService('http://pay.cmseasy.cn/sms.php');
    $client->setKeyLength(128);
    $client->setEncryptMode(3);
    $keys = config::get('sms_keyword');
    if ($keys != '') {
        $keys = explode(',', $keys);
        $content = str_ireplace($keys, '*', $content);
    }
    $rs = $client->sendMsg($mobile, $content, config::get('sms_username'), md5(config::get('sms_password')));
    if ($rs->SendSMSResult == '0') {
        $num = $tmp[0] + 1;
        file_put_contents('config/sms.tmp.php', $num . '@' . date('Y-m-d'));
    }
    return $rs;
}