public function hproseAct() { vendor('Hprose.HproseHttpClient'); $client = new \HproseHttpClient('http://localhost:8500/Api/HproseTest'); $result = $client->test(); dump($result); }
public function httpclientAction() { $client = new HproseHttpClient('http://yaf.zhaoquan.com/hprose/httpserver'); echo $client->hello('World'); echo $client->test->edg(); return false; }
public function run() { vendor('Hprose.HproseHttpClient'); $client = new \HproseHttpClient('http://127.0.0.1:81/Home/Server'); // $client = new \HproseHttpClient('http://127.0.0.1/lua/index'); // var_dump($client); // 或者采用 // $client = new \HproseHttpClient(); // var_dump($client); // $client->useService('http://127.0.0.1/index.php/Home/Server'); // $result = $client->test(); var_dump($client->test()); }
public static function keepSession() { if (isset($_SESSION["HPROSE_COOKIE_MANAGER"])) { self::$cookieManager = $_SESSION["HPROSE_COOKIE_MANAGER"]; } register_shutdown_function(array("HproseHttpClient", "hproseKeepCookieInSession")); }
请查阅LICENSE文件。 */ /* this file : $Id$ */ /*------------------------------------ include and initization of modules --------------------------------------*/ require_once "../include/hprose/HproseHttpClient.php"; require_once "../include/smarty/Smarty.class.php"; require_once "../include/asteriskconf/asteriskconf.inc.php"; require_once "../include/freeiris_common_inc.php"; // rpc url $rpcpbx = new HproseHttpClient($friconf['friextra_urlbase'] . '/rpcpbx.php'); // init $smarty = null; web_initialization(); /*------------------------------------ access permission and rpc health --------------------------------------*/ session_start(); // 未授权用户 if (!isset($_SESSION["admin"]) || $_SESSION["admin"] == false) { header('Location: ' . "index.php?action=page_relogin&callback=" . urlencode($_SERVER['REQUEST_URI']) . "\n\n"); exit; } // RPC身份注册 sendrequest($rpcpbx->base_clientlogin($_SESSION['res_admin']['adminid'], $_SESSION['res_admin']['passwd']), 0); /*------------------------------------
<?php require_once 'hprose-php/src/Hprose.php'; require_once 'hprose-filter-init.php'; // 只加密传递参数 // $client = new HproseHttpClient('http://192.168.1.200/hprose-filter-server.php'); // $myName = 'Laoliu'; // var_dump($myName, "\n"); // $args = encrypt($myName); // var_dump("Encrypt:",$args, "\n"); // $result = $client->testFilter($args); // var_dump("Result:",$result, "\n"); // $de = decrypt($result, "\n"); // var_dump("Decrypt:",$de); // 通过 Filter 加密全部请求 $client = new HproseHttpClient('http://192.168.1.200/hprose-filter-server.php'); $client->addFilter(new clientCryptFilter()); $myName = 'Laoliu'; var_dump($myName, "\n"); $result = $client->testFilter($myName); var_dump("Result:", $result, "\n");
<?php include 'hprose/Hprose.php'; $t = time(); $client = new HproseHttpClient('http://127.0.0.1/HService.php'); $result = $client->run('module', 'method', ['hello world'], ['appid' => 'appId', 'sign' => sha1('appKey' . $t), 'timestamp' => $t]); var_dump($result);
<?php require_once '../src/Hprose.php'; $test = new HproseHttpClient("http://127.0.0.1:8000"); $args = array("world"); var_dump($test->invoke("hello", $args, 0, HproseResultMode::Serialized, 0)); var_dump($test->invoke("hello", $args, 0, HproseResultMode::Raw, 0)); var_dump($test->invoke("hello", $args, 0, HproseResultMode::RawWithEndTag, 0)); try { $test->e(); } catch (Exception $e) { var_dump($e->getMessage()); } try { $test->ee(); } catch (Exception $e) { var_dump($e->getMessage()); } $test->hello('async world', function ($result, $args, $error) { echo "result: "; var_dump($result); echo "args: "; var_dump($args); echo "error: "; var_dump($error); }); $test->hello("async world2", function ($result, $args, $error) { echo "result: "; var_dump($result); echo "args: "; var_dump($args);