Пример #1
0
 /**
  * 初始化
  */
 private function _init()
 {
     $phprpcPath = LIB_PATH . '/phprpc/phprpc_client.php';
     if (!file_exists($phprpcPath)) {
         throw new Error('phprpc libs not exist');
     }
     include $phprpcPath;
     $this->_phpRpc = new PHPRPC_Client();
     $this->_phpRpc->setProxy(null);
     //设置代理
     $this->_phpRpc->setEncryptMode(0);
     $this->_phpRpc->setCharset('UTF-8');
     $this->_phpRpc->setTimeout(10);
 }
Пример #2
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条,请及时充值');
		}
    }
Пример #3
0
 /**
  * generate a PHPRPC_Client object
  * 构造一个PHPRPC_Client对象;
  *
  * @return void
  * @author renlu <*****@*****.**>
  **/
 private function _get_rpc()
 {
     global $rpc_client;
     if (empty($rpc_client)) {
         $rpc_client = new PHPRPC_Client();
         $rpc_client->setProxy(NULL);
         $rpc_client->useService($this->apiurl);
     }
     return $rpc_client;
 }
Пример #4
0
/** 
查询库里一共有多少记录
*/
function psearch_total()
{
    global $rpc_client;
    if (empty($rpc_client)) {
        $rpc_client = new PHPRPC_Client();
        $rpc_client->setProxy(NULL);
        $rpc_client->useService(SCH_API);
    }
    return $rpc_client->count(SCH_DB);
}
Пример #5
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)));
Пример #6
0
$starttime = time();
function enddo()
{
    global $starttime, $endtime;
    $endtime = time();
    print "used:";
    print $endtime - $starttime;
    print "seconds";
    //$j=$rpc_client->close_index_($db,$rows,array("text","author","name"));
    //print "closed:";
    //print_r($j);
}
register_shutdown_function("enddo");
include "./phprpc_client.php";
$rpc_client = new PHPRPC_Client();
$rpc_client->setProxy(NULL);
$rpc_client->useService('http://w02.pdb.cnb:8020/');
#$rpc_client->setKeyLength(1024);
#$rpc_client->setEncryptMode(3);
$db = "./amazon";
$res = $rpc_client->create_index($db, array("text", "author", "name"), array("text", "author", "name"), array());
print_r($res);
$book2 = array("text" => "jojo", "author" => "ma", "name" => "goto");
$startitem = intval(file_get_contents("./offset"));
$k = 0;
for ($i = 933; $i < 3300; $i++) {
    $start = $i * 200;
    file_put_contents("./start", $start);
    $SQL = "SELECT id,name,author,brief FROM book LIMIT {$start},200";
    $conn = mysql_connect("h07-vm16.corp.cnb.yahoo.com", "yahoo", "");
    mysql_select_db("book", $conn);
Пример #7
0
 public function actionTest()
 {
     $serverList = $this->_getGlobalData('gameser_list');
     $server = $serverList[$_REQUEST['server_id']]['server_url'] . 'rpc/user';
     $phprpcPath = LIB_PATH . '/phprpc/phprpc_client.php';
     if (!file_exists($phprpcPath)) {
         throw new Error('phprpc libs not exist');
     }
     include_once $phprpcPath;
     $phpRpc = new PHPRPC_Client();
     $phpRpc->useService($server);
     $phpRpc->setProxy(null);
     //设置代理
     $phpRpc->setEncryptMode(0);
     $phpRpc->setCharset('UTF-8');
     $phpRpc->setTimeout(10);
     $phpRpc->setPrivateKey('test');
     $dataList = $phpRpc->getInfo('wcj');
     print_r($dataList);
 }
Пример #8
0
function ra_get_keywords($content, $post_id)
{
    global $wpdb;
    $keywords = ra_fetch_row("keywords_" . $post_id);
    if (!empty($keywords)) {
        return $keywords;
    } else {
        $url = CLOUDAPI_URL;
        $rpc = new PHPRPC_Client();
        $rpc->setProxy(NULL);
        $rpc->useService($url);
        $ret = $rpc->api_getkeywords(strip_tags($content), 8, "n");
        $keywords = array();
        foreach ($ret["data"] as $v) {
            $keywords[] = $v[0];
        }
        ra_set_row("keywords_" . $post_id, $keywords);
        return $keywords;
    }
}
Пример #9
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;
}