示例#1
0
 public function phpRPCAct()
 {
     Vendor('phpRPC.phprpc_client');
     $client = new \PHPRPC_Client('http://localhost:8500/Api/RpcTest');
     $result = $client->test();
     dump($result);
 }
示例#2
0
 /**
  * 设置URL,如果有参数就加上$params
  * @param int $server
  * @param string $params
  */
 public function setUrl($server, $params = null)
 {
     if (!is_null($params)) {
         $server .= $params;
     }
     $this->_phpRpc->useService($server);
 }
示例#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
 /**
  * 设置URL,如果有参数就加上$params
  * @param int $server
  * @param string $params
  */
 public function setUrl($server, $params = null, $username = NULL, $password = NULL)
 {
     if (is_numeric($server)) {
         $serverList = $this->_getGlobalData('gameser_list');
         $server = $serverList[$server]['server_url'];
     }
     if (!is_null($params)) {
         $server .= $params;
     }
     $this->_phpRpc->useService($server, $username = NULL, $password = NULL);
 }
示例#5
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条,请及时充值');
		}
    }
示例#6
0
 public function __construct($array)
 {
     parent::PHPRPC_Client();
 }
示例#7
0
<?php 
include "phprpc_client.php";
$client = new PHPRPC_Client('http://129.0.0.1/work/obsidian/libs/phprpc/server.php');
$client->setTimeout(5);
$client->setEncryptMode(3);
try {
    $out = $client->HelloWorld();
    echo $out;
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
示例#8
0
文件: psearch.php 项目: xurenlu/tik
/** 
查询库里一共有多少记录
*/
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);
}
示例#9
0
<?php

require_once './testrpc3/phprpc_client.php';
/**
 if (class_exists('PHPRPC_Client')) {
 echo "exist";
 }else{
 echo "not exist";
 }
**/
// $client = new PHPRPC_Client('http://bbs.hc3i.cn/api/rpcServer.php');
$client = new PHPRPC_Client('http://bbs.hc3i.cn/api/mobileServer.php');
$userSynInfo = $client->getCreditsInfo(65138);
var_dump($userSynInfo);
if (empty($userSynInfo)) {
    //第一次注册,未登录过论坛
    //$client->updateCreditsInfo($getcreditsuid,'coin',10,'+');
    //$client->updateCreditsInfo($getcreditsuid,'score',1,'+');
}
示例#10
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)));
示例#11
0
<?php

include 'core.php';
include "libs/phprpc/phprpc_client.php";
$client = new PHPRPC_Client('http://127.0.0.1/work/obsidian/rpc.php?key=' . Config::$intpass);
$client->setTimeout(5);
$client->setEncryptMode(3);
try {
    print_r($client->CheckLogin('kayomani', '2dbf2c8b82421856957e4469a7834d86'));
    return;
    $userList = $client->GetUsers();
    foreach ($userList as $user) {
        $luser = new Lan_users();
        $luser->id = $user->id;
        if (0 == $luser->count()) {
            $luser->username = $user->username;
            $luser->id = $user->id;
            $luser->password = $user->password;
            $luser->email = $user->email;
            $luser->role = $user->role;
            $luser->clan = $user->clan;
            $luser->insert();
            echo "insert";
        } else {
            $luser->username = $user->username;
            $luser->id = $user->id;
            $luser->password = $user->password;
            $luser->email = $user->email;
            $luser->role = $user->role;
            $luser->clan = $user->clan;
            $luser->update();
示例#12
0
 public function index()
 {
     $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array());
     try {
         $request_data = $this->input->get();
         $site_ids = role::get_site_ids();
         if (empty($site_ids)) {
             throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
         }
         $site_id = site::id();
         if ($site_id <= 0 && !in_array($site_id, $site_ids)) {
             throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
         }
         //获取站点的统计ID
         $site_detail = Mysite::instance($site_id)->detail();
         $statking_id = $site_detail['statking_id'];
         $site_name = Mysite::instance($site_id)->get('domain');
         //$statking_id = 100097;
         require_once Kohana::find_file('vendor', 'phprpc/phprpc_client', TRUE);
         $client = new PHPRPC_Client($this->phprpc_server);
         $date_today = date('Y-m-d');
         //今日数据
         $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
         $args = array($statking_id, strtotime($date_today . $this->time_offset));
         $sign = md5(json_encode($args) . $phprpc_statking_key);
         $today = $client->get_data_pv_ip_by_time($statking_id, strtotime($date_today . $this->time_offset), $sign);
         //昨日数据
         $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
         $args = array($statking_id, strtotime(date('Y-m-d', time() - 86400) . $this->time_offset));
         $sign = md5(json_encode($args) . $phprpc_statking_key);
         $yesterday = $client->get_data_pv_ip_by_time($statking_id, strtotime(date('Y-m-d', time() - 86400) . $this->time_offset), $sign);
         //24小时流量
         $now_hour = intval(date('H'));
         $hours = array();
         $ps1 = $ps2 = $ct = $chart_data = '';
         $pv_max = $ip_min = 0;
         for ($i = $now_hour + 1; $i <= 23; $i++) {
             $hours[]['h'] = $i;
             $hours[]['v'] = $yesterday['hours'][$i];
             $ct == '' ? $ct .= $i : ($ct .= ',' . $i);
             $ps1 == '' ? $ps1 .= $yesterday['hours'][$i]['pv'] : ($ps1 .= ',' . $yesterday['hours'][$i]['pv']);
             $ps2 == '' ? $ps2 .= $yesterday['hours'][$i]['ip_count'] : ($ps2 .= ',' . $yesterday['hours'][$i]['ip_count']);
             $chart_data .= "{$i};{$yesterday['hours'][$i]['pv']};{$yesterday['hours'][$i]['ip_count']}\n";
             if ($yesterday['hours'][$i]['pv'] > $pv_max) {
                 $pv_max = $yesterday['hours'][$i]['pv'];
             }
             $ip_min == 0 ? $ip_min = $yesterday['hours'][$i]['ip_count'] : '';
             if ($yesterday['hours'][$i]['ip_count'] < $ip_min) {
                 $ip_min = $yesterday['hours'][$i]['ip_count'];
             }
         }
         for ($i = 0; $i <= $now_hour; $i++) {
             $hours[]['h'] = $i;
             $hours[]['v'] = $today['hours'][$i];
             $ct == '' ? $ct .= $i : ($ct .= ',' . $i);
             $ps1 == '' ? $ps1 .= $today['hours'][$i]['pv'] : ($ps1 .= ',' . $today['hours'][$i]['pv']);
             $ps2 == '' ? $ps2 .= $today['hours'][$i]['ip_count'] : ($ps2 .= ',' . $today['hours'][$i]['ip_count']);
             $chart_data .= "{$i};{$today['hours'][$i]['pv']};{$today['hours'][$i]['ip_count']}\n";
             if ($today['hours'][$i]['pv'] > $pv_max) {
                 $pv_max = $today['hours'][$i]['pv'];
             }
             $ip_min == 0 ? $ip_min = $today['hours'][$i]['ip_count'] : '';
             if ($today['hours'][$i]['ip_count'] < $ip_min) {
                 $ip_min = $today['hours'][$i]['ip_count'];
             }
         }
         if ($pv_max == $ip_min) {
             $pv_max = $ip_min + 10;
         }
         $src1 = "/sitestat/chart?type=lc&w=800&h=300&ma={$pv_max}&mi={$ip_min}&r=10&t=pv-ip&ct={$ct}&sp=30&g=2&ps1={$ps1}&ps2={$ps2}&clr1=255,0,0&clr2=0,255,0";
         $src2 = "/sitestat/chart?type=bg&w=800&h=300&ma={$pv_max}&mi={$ip_min}&r=10&t=pv-ip&ct={$ct}&sp=30&g=2&ps1={$ps1}&ps2={$ps2}&clr1=255,0,0&clr2=0,255,0";
         $flash1 = "<embed width=\"800\" height=\"400\" flashvars=\"path=/amline/&settings_file=/amline/chart_settings/pv_ip.xml&chart_data={$chart_data}\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#FFFFFF\" name=\"img_src1\" id=\"img_src1\" style=\"\" src=\"/amline/amline.swf\" type=\"application/x-shockwave-flash\">";
         $flash2 = "<embed width=\"800\" height=\"400\" flashvars=\"path=/amline/&settings_file=/amline/chart_settings/pv_ip.xml&chart_data={$chart_data}&preloader_color=#999999\" quality=\"high\" bgcolor=\"#FFFFFF\" name=\"img_src2\" id=\"img_src2\" style=\"display:none\" src=\"/amline/amcolumn.swf\" type=\"application/x-shockwave-flash\">";
         //站点概况
         $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
         $args = array($statking_id);
         $sign = md5(json_encode($args) . $phprpc_statking_key);
         $overview = $client->get_data_pv_ip_by_one_site($statking_id, $sign);
         //来路域名
         $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
         $args = array($statking_id, strtotime($date_today . $this->time_offset), strtotime($date_today . $this->time_offset));
         $sign = md5(json_encode($args) . $phprpc_statking_key);
         $domains_all = $client->get_data_domain_by_time_range($statking_id, strtotime($date_today . $this->time_offset), strtotime($date_today . $this->time_offset), 0, 1, 10, $sign);
         $domains = $domains_all['data'];
         //受访页面
         $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
         $args = array($statking_id, strtotime($date_today . $this->time_offset), strtotime($date_today . $this->time_offset));
         $sign = md5(json_encode($args) . $phprpc_statking_key);
         $pages_all = $client->get_data_page_by_time_range($statking_id, strtotime($date_today . $this->time_offset), strtotime($date_today . $this->time_offset), 0, 1, 10, $sign);
         $pages = $pages_all['data'];
         //地区分布
         $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
         $args = array($statking_id, strtotime($date_today . $this->time_offset), strtotime($date_today . $this->time_offset));
         $sign = md5(json_encode($args) . $phprpc_statking_key);
         $areas_all = $client->get_data_country_by_time_range($statking_id, strtotime($date_today . $this->time_offset), strtotime($date_today . $this->time_offset), 0, 1, 10, $sign);
         $areas = $areas_all['data'];
         $ps = $pts = '';
         $chart_data = "[title];[value]\n";
         for ($i = 1; $i < count($areas); $i++) {
             $ps .= $ps == '' ? $areas[$i]['pv'] : ',' . $areas[$i]['pv'];
             $pts .= $pts == '' ? $areas[$i]['name'] : ',' . $areas[$i]['name'];
             $chart_data .= "{$areas[$i]['name']};{$areas[$i]['pv']}\n";
         }
         $chart_data = urlencode($chart_data);
         $src3 = "/sitestat/chart?type=pc&w=400&h=200&ps={$ps}&pts={$pts}";
         $flash3 = "<embed width=\"800\" height=\"400\" flashvars=\"path=/amline/&settings_file=/amline/chart_settings/pie.xml&chart_data={$chart_data}\" quality=\"high\" bgcolor=\"#FFFFFF\" name=\"amline\" id=\"amline\" style=\"\" src=\"/amline/ampie.swf\" type=\"application/x-shockwave-flash\">";
         $content = new View($this->package_name . '/' . $this->class_name . '/' . 'index');
         $this->template->content = $content;
         $this->template->content->site_name = $site_name;
         $this->template->content->sitestat_left = new View($this->package_name . '/sitestat_left');
         $this->template->content->sitestat_left->overview = 1;
         $this->template->content->today_pv_ip = $today['day'];
         $this->template->content->yesterday_pv_ip = $yesterday['day'];
         $this->template->content->average = $overview['average'];
         $this->template->content->highest = $overview['highest'];
         $this->template->content->total = $overview['total'];
         $this->template->content->src1 = $src1;
         $this->template->content->src2 = $src2;
         $this->template->content->src3 = $src3;
         $this->template->content->flash1 = $flash1;
         $this->template->content->flash2 = $flash2;
         $this->template->content->flash3 = $flash3;
         $this->template->content->domains = $domains;
         $this->template->content->pages = $pages;
     } catch (MyRuntimeException $ex) {
         $return_struct['status'] = 0;
         $return_struct['code'] = $ex->getCode();
         $return_struct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->is_ajax_request()) {
             $this->template->content = $return_struct;
         } else {
             $this->template->return_struct = $return_struct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->request_data = $request_data;
             //* 返回结构体绑定 */
             $this->template->content->return_struct = $return_struct;
         }
     }
 }
示例#13
0
 function clientAction()
 {
     $this->_helper->layout->disableLayout();
     if ($this->_request->isPost()) {
         //POST
         ini_set("soap.wsdl_cache_enabled", "0");
         //			$client = new PHPRPC_Client("http://home.xingxinghuo.cn/public/ws/ws/server");
         $client = new PHPRPC_Client('http://localhost/wildfire/public/ws/ws/server');
         $this->view->result = null;
         $interface = $this->_request->getParam("interface");
         try {
             switch ($interface) {
                 case 'decrypt':
                     $this->view->inter = "decrypt";
                     $this->view->paramter1 = $this->_request->getParam("paramter1");
                     $this->view->paramter2 = $this->_request->getParam("paramter2");
                     $this->view->paramter3 = $this->_request->getParam("paramter3");
                     $this->view->paramter4 = $this->_request->getParam("paramter4");
                     $this->view->paramter5 = $this->_request->getParam("paramter5");
                     $this->view->result = $client->decrypt($this->view->paramter1, $this->view->paramter2, $this->view->paramter3, $this->view->paramter4, $this->view->paramter5);
                     break;
                 case 'verifyAccount':
                     $this->view->inter = "verifyAccount";
                     $this->view->paramter1 = $this->_request->getParam("paramter1");
                     $this->view->paramter2 = $this->_request->getParam("paramter2");
                     $this->view->result = $client->verifyAccount($this->view->paramter1, $this->view->paramter2);
                     break;
                 case 'exchange':
                     $this->view->inter = "exchange";
                     $this->view->paramter1 = $this->_request->getParam("paramter1");
                     $this->view->paramter2 = $this->_request->getParam("paramter2");
                     $this->view->paramter3 = $this->_request->getParam("paramter3");
                     $this->view->result = $client->exchange($this->view->paramter1, $this->view->paramter2, $this->view->paramter3);
                     break;
                 case 'getCurrentPoint':
                     $this->view->inter = "getCurrentPoint";
                     $this->view->paramter1 = $this->_request->getParam("paramter1");
                     $this->view->paramter2 = $this->_request->getParam("paramter2");
                     $para = array('userName' => $this->view->paramter1, 'password' => $this->view->paramter2);
                     $this->view->result = $client->getCurrentPoint($this->view->paramter1, $this->view->paramter2);
                     break;
                 default:
                     break;
             }
         } catch (Zend_Exception $e) {
             echo $e->getMessage();
         }
     } else {
         ini_set("soap.wsdl_cache_enabled", "0");
         $client = new PHPRPC_Client("http://home.xingxinghuo.cn/public/ws/ws/server");
         //			$client = new PHPRPC_Client('http://localhost/wildfire/public/ws/ws/server');
         $this->view->inter = "decrypt";
         $this->view->paramter1 = $this->_request->getParam("site");
         $this->view->paramter2 = $this->_request->getParam("username");
         $this->view->paramter3 = $this->_request->getParam("password");
         $this->view->paramter4 = $this->_request->getParam("realname");
         $this->view->paramter5 = $this->_request->getParam("auth");
         $this->view->result = $client->decrypt($this->view->paramter1, $this->view->paramter2, $this->view->paramter3, $this->view->paramter4, $this->view->paramter5);
     }
     $key = "ILoveXingXingHuo";
     $value = "*****@*****.**";
     //		$value = "*****@*****.**";
     $value2 = "96e79218965eb72c92a549dd5a330112";
     $value3 = "xingxinghuo";
     $value4 = "星星火会员";
     //		$value4 = mb_convert_encoding($value4, "UTF-8");
     $value5 = "xingxinghuodecrypt";
     $td = mcrypt_module_open('tripledes', '', 'ecb', '');
     $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
     mcrypt_generic_init($td, $key, $iv);
     $ret = base64_encode(mcrypt_generic($td, $value));
     $ret2 = base64_encode(mcrypt_generic($td, $value2));
     $ret3 = base64_encode(mcrypt_generic($td, $value3));
     $ret4 = base64_encode(mcrypt_generic($td, $value4));
     $ret5 = base64_encode(mcrypt_generic($td, $value5));
     $ret_de = mdecrypt_generic($td, base64_decode($ret));
     $ret2_de = mdecrypt_generic($td, base64_decode($ret2));
     $ret3_de = mdecrypt_generic($td, base64_decode($ret3));
     $ret4_de = mdecrypt_generic($td, base64_decode($ret4));
     $ret5_de = mdecrypt_generic($td, base64_decode($ret5));
     mcrypt_generic_deinit($td);
     mcrypt_module_close($td);
     Zend_Debug::dump('username:'******'password:'******'site:' . $ret3);
     Zend_Debug::dump('name:' . $ret4);
     Zend_Debug::dump($ret5);
     Zend_Debug::dump($ret_de);
     Zend_Debug::dump($ret2_de);
     Zend_Debug::dump($ret3_de);
     Zend_Debug::dump($ret4_de);
     Zend_Debug::dump($ret5_de);
     //		$this->_helper->redirector('client','ws');
     //		try {
     //			$client = new SoapClient("http://localhost/wildfire/public/ws/ws/server?WSDL",array("trace" => 1)); // Servers WSDL Location
     //
     //			$string =  $client->helloWorld('Wildfire');
     //
     //			Zend_Debug::dump($string);
     //
     //		} catch(Zend_Exception  $e) {
     //			echo $e->getMessage();
     //		}
 }
示例#14
0
 /**
  * 删除数据 action
  */
 public function delete()
 {
     $returnStruct = array('status' => 0, 'code' => 501, 'msg' => _('Not Implemented'), 'content' => array());
     try {
         // 是否调用本地服务
         $useLocalService = TRUE;
         //$useLocalService = FALSE;
         //* 初始化返回数据 */
         $returnStatus = 1;
         $returnCode = 200;
         $returnMessage = '';
         $returnData = array();
         //* 收集请求数据 ==根据业务逻辑定制== */
         $requestData = $this->input->get();
         //* 实现功能后屏蔽此异常抛出 */
         //throw new MyRuntimeException(_('Not Implemented'),501);
         //* 权限验证,数据验证,逻辑验证 ==根据业务逻辑定制== */
         //if(util::isAccess(array(Logon::$MGR_ROLE_LABEL_SYS_ADMIN,), array(Logon::$USER_ROLE_LABEL_DENIED,Logon::$USER_ROLE_LABEL_GUEST), $this->getUserRoleLabel())==FALSE){
         //    throw new MyRuntimeException(_('Access Denied'),403);
         //}
         if (util::isAccess('*', array(Logon::$USER_ROLE_LABEL_DENIED), $this->getUserRoleLabel()) == FALSE) {
             throw new MyRuntimeException(_('Access Denied'), 403);
         }
         //* 权限验证 ==根据业务逻辑定制== */
         //* 数据验证 ==根据业务逻辑定制== */
         if (!isset($requestData['id']) || empty($requestData['id']) || !is_numeric($requestData['id'])) {
             throw new MyRuntimeException(_('Bad Request,id required'), 400);
         }
         //* 逻辑验证 ==根据业务逻辑定制== */
         // 调用底层服务
         !isset($servRouteInstance) && ($servRouteInstance = ServRouteInstance::getInstance(ServRouteConfig::getInstance()));
         // 执行业务逻辑
         // TODO 根据数据特征定制对应的服务实例
         if ($useLocalService == TRUE) {
             !isset($attachmentService) && ($attachmentService = Attachment_Service::getInstance($servRouteInstance));
         } else {
             require_once Lemon::find_file('vendor', 'phprpc/phprpc_client', TRUE);
             !isset($attachmentService) && ($attachmentService = new PHPRPC_Client(Lemon::config('phprpc.remote.Attachment.host')));
             !isset($phprpcApiKey) && ($phprpcApiKey = Lemon::config('phprpc.remote.Attachment.apiKey'));
         }
         try {
             if ($useLocalService == TRUE) {
                 $attachmentService->removeAttachmentDataByAttachmentId($requestData['id']);
             } else {
                 $args = array($requestData['id']);
                 $sign = md5(json_encode($args) . $phprpcApiKey);
                 $attachmentService->phprpc_removeAttachmentDataByAttachmentId($requestData['id'], $sign);
             }
         } catch (MyRuntimeException $ex) {
             //* ==根据业务逻辑定制== */
             //FIXME 根据service层的异常做一些对应处理并抛出用户友好的异常Message
             throw $ex;
         }
         $returnMessage = _('Sucess');
         //* 补充&修改返回结构体 */
         $returnStruct['status'] = $returnStatus;
         $returnStruct['code'] = $returnCode;
         $returnStruct['msg'] = $returnMessage;
         $returnStruct['content'] = $returnData;
         //* 请求类型 */
         if ($this->isAjaxRequest()) {
             // ajax 请求
             // json 输出
             $this->template->content = $returnStruct;
         } else {
             // html 输出
             //* 模板输出 */
             $this->template->returnStruct = $returnStruct;
             $content = new View('info');
             //* 变量绑定 */
             $this->template->title = Lemon::config('site.name');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->requestData = $requestData;
             //* 返回结构体绑定 */
             $this->template->content->returnStruct = $returnStruct;
             //:: 当前应用专用数据
             $this->template->content->title = Lemon::config('site.name');
         }
         // end of request type determine
     } catch (MyRuntimeException $ex) {
         $returnStruct['status'] = 0;
         $returnStruct['code'] = $ex->getCode();
         $returnStruct['msg'] = $ex->getMessage();
         //TODO 异常处理
         //throw $ex;
         if ($this->isAjaxRequest()) {
             $this->template->content = $returnStruct;
         } else {
             $this->template->returnStruct = $returnStruct;
             $content = new View('info');
             $this->template->content = $content;
             //* 请求结构数据绑定 */
             $this->template->content->requestData = $requestData;
             //* 返回结构体绑定 */
             $this->template->content->returnStruct = $returnStruct;
         }
     }
 }
示例#15
0
<?php

require_once 'lib/phprpc/phprpc_client.php';
$client = new PHPRPC_Client('http://localhost/zh2/rpc.php');
echo $client->do_login();
示例#16
0
<?php

header("Content-type: text/html;charset=utf-8");
// 查询DownLoad数据
require_once './phprpc3/phprpc_client.php';
$client = new PHPRPC_Client('http://share.hc3i.cn/api/rpcServer.php');
$rs = $client->month_paihang(10, 0, 4);
var_dump($rs);
示例#17
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;
    }
}
示例#18
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;
}
示例#19
0
 /**
  * 添加存储文件
  *
  */
 public function add_attach($file_meta)
 {
     $site_id = $file_meta['site_id'];
     $site = Mysite::instance($site_id)->get();
     $site_domain = $site['domain'];
     //'www.2.opococ.com';
     $timestamp_current = time();
     $src_ip_address = Input::instance()->ip_address();
     // 需要提效数据
     $attach_meta = array('siteId' => $site_id, 'siteDomain' => $site_domain);
     $attachment_data_original = array('filePostfix' => $file_meta['type'], 'fileMimeType' => $file_meta['mime'], 'fileSize' => $file_meta['size'], 'fileName' => $file_meta['name'], 'srcIp' => $src_ip_address, 'attachMeta' => json_encode($attach_meta), 'createTimestamp' => $timestamp_current, 'modifyTimestamp' => $timestamp_current);
     require_once Kohana::find_file('vendor', 'phprpc/phprpc_client', TRUE);
     $attachmentService = new PHPRPC_Client(Kohana::config('phprpc.remote.Attachment.host'));
     $phprpcApiKey = Kohana::config('phprpc.remote.Attachment.apiKey');
     // 调用后端添加附件信息,并调用存储服务存储文件
     $args_org = array($attachment_data_original);
     $sign_org = md5(json_encode($args_org) . $phprpcApiKey);
     $attachment_original_id = $attachmentService->phprpc_addAttachmentFileData($attachment_data_original, @file_get_contents($file_meta['tmpfile']), $sign_org);
     return $attachment_original_id;
 }
示例#20
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);
 }
示例#21
0
 private function get_request_data($date_from, $date_to, $order_by = 0)
 {
     if (empty($this->site_ids)) {
         throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403);
     }
     if ($this->site_id <= 0 && !in_array($this->site_id, $this->site_ids)) {
         throw new MyRuntimeException(Kohana::lang('o_global.select_site'), 400);
     }
     //获取站点的统计ID
     $statking_site_name = $this->get_statking_id_site_name();
     $statking_id = $statking_site_name['statking_id'];
     $site_name = $statking_site_name['site_name'];
     //PHPRPC客户端
     require_once Kohana::find_file('vendor', 'phprpc/phprpc_client', TRUE);
     $client = new PHPRPC_Client($this->phprpc_server);
     $time_from = strtotime($date_from . $this->time_offset);
     $time_to = strtotime($date_to . $this->time_offset);
     //生成要发送的密钥
     $phprpc_statking_key = Kohana::config('phprpc.remote.statking.api_key');
     $args = array($statking_id, $time_from, $time_to);
     $sign = md5(json_encode($args) . $phprpc_statking_key);
     //页码
     $page = $this->getpage();
     //发送请求获取原始数据
     $data_all = $client->get_data_domain_by_time_range($statking_id, $time_from, $time_to, $order_by = 0, $page, $this->perpage, $sign);
     //原始数据处理
     $data = $this->manage_data($data_all, $date_from, $date_to);
     $data['site_name'] = $site_name;
     return $data;
 }
示例#22
0
文件: import.php 项目: xurenlu/tik
ignore_user_abort();
$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", "");