public static function handleRpc() { global $model, $viewRegistration; $jsonRpc = new jsonRPCServer(); foreach ($viewRegistration as $crntView) { $rpcClass = $crntView->getRpcClass(); if ($rpcClass) { $jsonRpc->registerClass($rpcClass); } } $jsonRpc->handle() or die('no request'); }
/** * 架构函数 * @access public */ public function __construct() { //控制器初始化 if (method_exists($this, '_initialize')) { $this->_initialize(); } // 启动server jsonRPCServer::handle($this); }
/** * 架构函数 * @access public */ public function __construct() { //控制器初始化 if (method_exists($this, '_initialize')) { $this->_initialize(); } //导入类库 \think\Loader::import('vendor.jsonrpc.jsonRPCServer'); // 启动server \jsonRPCServer::handle($this); }
/** * 架构函数 * @access public */ public function __construct() { //控制器初始化 if (method_exists($this, '_initialize')) { $this->_initialize(); } //导入类库 Vendor('jsonRPC.jsonRPCServer'); //实例化phprpc \jsonRPCServer::handle($this); }
/** * This is the XML-RPC server routine * * @access public * @return void */ public function run() { $RPCType = Yii::app()->getConfig("RPCInterface"); if ($RPCType == 'xml') { $cur_path = get_include_path(); set_include_path($cur_path . PATH_SEPARATOR . APPPATH . 'helpers'); // Yii::import was causing problems for some odd reason require_once 'Zend/XmlRpc/Server.php'; require_once 'Zend/XmlRpc/Server/Exception.php'; require_once 'Zend/XmlRpc/Value/Exception.php'; $this->xmlrpc = new Zend_XmlRpc_Server(); $this->xmlrpc->sendArgumentsToAllMethods(false); $this->xmlrpc->setClass('remotecontrol_handle', '', $this->controller); echo $this->xmlrpc->handle(); } elseif ($RPCType == 'json') { Yii::app()->loadLibrary('jsonRPCServer'); $oHandler = new remotecontrol_handle($this->controller); jsonRPCServer::handle($oHandler); } exit; }
/** * This is the XML-RPC server routine * * @access public * @return void */ public function run() { $oHandler = new remotecontrol_handle($this->controller); $RPCType = Yii::app()->getConfig("RPCInterface"); if (Yii::app()->getRequest()->isPostRequest) { if ($RPCType == 'xml') { $cur_path = get_include_path(); set_include_path($cur_path . PATH_SEPARATOR . APPPATH . 'helpers'); // Yii::import was causing problems for some odd reason require_once 'Zend/XmlRpc/Server.php'; require_once 'Zend/XmlRpc/Server/Exception.php'; require_once 'Zend/XmlRpc/Value/Exception.php'; $this->xmlrpc = new Zend_XmlRpc_Server(); $this->xmlrpc->sendArgumentsToAllMethods(false); $this->xmlrpc->setClass($oHandler); echo $this->xmlrpc->handle(); } elseif ($RPCType == 'json') { Yii::app()->loadLibrary('jsonRPCServer'); jsonRPCServer::handle($oHandler); } exit; } else { // Disabled output of API methods for now if (1 == 2 && in_array($RPCType, array('xml', 'json'))) { $reflector = new ReflectionObject($oHandler); foreach ($reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { /* @var $method ReflectionMethod */ if (substr($method->getName(), 0, 1) !== '_') { $list[$method->getName()] = array('description' => str_replace(array("\r", "\r\n", "\n"), "<br/>", $method->getDocComment()), 'parameters' => $method->getParameters()); } } ksort($list); $aData['method'] = $RPCType; $aData['list'] = $list; $aData['display']['menu_bars'] = false; // Hide normal menu bar $this->_renderWrappedTemplate('remotecontrol', array('index_view'), $aData); } } }
function process($source_id, $pmb_user_id, $json_input) { global $charset; global $wsdl; global $class_path; $the_source = $this->connector_object->instantiate_source_class($source_id); if (!isset($the_source->config["exported_functions"])) { $this->return_error("Source wasn't configured"); } $allowed_methods = array(); foreach ($the_source->config["exported_functions"] as $aallowed_method) { $allowed_methods[] = $aallowed_method['group'] . '_' . $aallowed_method['name']; } $json_operation = ''; $request = $json_input; if ($request) { $json_operation = $request["method"]; } //Instantions la classe qui contient les fonctions $ess = new external_services(true); if ($json_operation && $ess->operation_need_messages($json_operation)) { //Allons chercher les messages global $class_path; global $include_path; global $lang; require_once "{$class_path}/XMLlist.class.php"; $messages = new XMLlist("{$include_path}/messages/{$lang}.xml", 0); $messages->analyser(); global $msg; $msg = $messages->table; } if ($json_operation) { $proxy = $ess->get_proxy($pmb_user_id, array($json_operation)); } else { $proxy = $ess->get_proxy($pmb_user_id); } $proxy->input_charset = 'utf-8'; jsonRPCServer::handle($proxy, $allowed_methods, $json_input) or print 'No request'; }
<?php require_once 'jsonRPCServer.php'; require 'example.php'; require 'restrictedExample.php'; $myExample = new restrictedExample(); jsonRPCServer::handle($myExample) or print 'no request';
<?php require 'resources/jsonRPCserver.php'; require 'resources/rpchandler.php'; $rpchandler = new RPCHandler(); jsonRPCServer::handle($rpchandler) or print 'no request';
$password = $_SERVER['PHP_AUTH_PW']; } elseif (isset($_SERVER['HTTP_AUTHENTICATION'])) { // Then try what most other servers might do if (strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']), 'basic') === 0) { list($username, $password) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); } } //Check Login if (is_null($username)) { header('WWW-Authenticate: Basic realm="' . APPLICATION_NAME . ' RPC"'); header('HTTP/1.0 401 Unauthorized'); echo '401 Unauthorized'; die; } else { if ($username != PAYMENT_GW_RPC_USER || $password != PAYMENT_GW_RPC_PASS) { // Incorrect Login header('HTTP/1.0 401 Unauthorized'); echo '401 Unauthorized'; die; } } //This is only accetable if the cold wallet in in use if (PAYMENT_GW_DATAFILE == "") { header('HTTP/1.0 501 Not Implemented'); die; } //We good from this point forward $COLD_WALLET = new ColdWalletAdvanced(ADDRESS_VERSION, $DB, PAYMENT_GW_DATAFILE); $RPC = new FaucetRPC($DB, $COLD_WALLET); jsonRPCServer::handle($RPC) or header('HTTP/1.0 400 Bad Request');
<?php require_once "TimeTrackAPI.class.php"; require_once "jsonRPCServer.php"; $api = new TimeTrackAPI(); jsonRPCServer::handle($api);
function mingapi_request() { $ts = time() - 3600; $sql = "DELETE FROM api_sessions WHERE last_activity < {$ts}"; Core::get()->dbQuery($sql); $MingaApi = new MingaApi(); jsonRPCServer::handle($MingaApi); return; }
{ // checks if a JSON-RCP request has been received if ($_SERVER['REQUEST_METHOD'] != 'POST' || empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/json') { // This is not a JSON-RPC request return false; } // reads the input data $request = json_decode(file_get_contents('php://input'), true); // executes the task on local object try { if ($result = @call_user_func_array(array($object, $request['method']), $request['params'])) { $response = array('id' => $request['id'], 'result' => $result, 'error' => NULL); } else { $response = array('id' => $request['id'], 'result' => NULL, 'request' => $request, 'error' => 'unknown method or incorrect parameters '); } } catch (Exception $e) { $response = array('id' => $request['id'], 'result' => NULL, 'error' => $e->getMessage()); } // output the response if (!empty($request['id'])) { // notifications don't want response header('content-type: application/json'); echo json_encode($response); } // finish return true; } } $getAPI = call_user_func(array($_GET['system'], "api")); jsonRPCServer::handle($getAPI) or print 'no request';
<?php require_once 'jsonRPCServer.php'; include 'math.php'; $obj = new Math(); jsonRPCServer::handle($obj) or print 'no request';