public function getSupportedVersions() { $proxy = new HessianClient($this->fullUrl); $versions = $proxy->getSupportedVersions(); unset($proxy); return $versions; }
public function wsclient() { $testurl = 'http://127.0.0.1/vote/poll/ws.html'; $proxy = new HessianClient($testurl); try { echo $proxy->div(2, 5); } catch (Exception $ex) { echo $ex; } }
<?php /** * Description of Iqiyi * * @author gaven */ require_once dirname(__FILE__) . '/ContentManager.php'; require_once dirname(__FILE__) . '/hessian/src/HessianClient.php'; /** 测试最新的 iqiyi接口 */ try { $testurl = 'http://iface2.iqiyi.com/php/xyz/iface/?device_id=a39eeeea4e9eee4e5e71dc3f4ecac6538e242e25&ua=iPad2,1&key=f0f6c3ee5709615310c0f053dc9c65f2&version=3.7&network=1&os=5.0.1&screen_status=2&getother=0'; $proxy = new HessianClient($testurl); //参数 1:album id, 2:vod id $content = $proxy->__hessianCall('getAlbum', array('605082', '605082', '1', '0')); //605082 //var_dump($content); } catch (Exception $ex) { //var_dump($ex); } class IqiyiContent { const API = 'http://cache.m.iqiyi.com/mt/{aid}/'; //621409 private $p_code = 'utf-8'; public function parseAndroidVideoUrl($url, $p_coding, $p_script) { $content = getPageWindow($url, $this->p_code); writetofile("iqiyi.log", "page url:" . $url);
require_once './collectionEditionApi.inc.php'; require_once './ServerVersion.inc.php'; $url = 'http://192.168.10.229:9359'; $version = 1; echo "URL = {$url}\n"; $serverVer = new ServerVersion($url, 'CollectionEditionAPI'); $path = $serverVer->getVersionPath($version); if (is_null($path)) { echo "Supported versions are:\n"; $versions = $serverVer->getSupportedVersions(); print_r($versions); echo "\n"; die("api version {$version} not supported"); } echo "Path = {$path}\n"; $proxy = new HessianClient($url . $path); registerEditionMethods($url . $path); $result = $proxy->getCollectionEditions(); echo "\n\n=== Editions:\n\n"; var_export($result); echo "\n\n=== Add Edition:\n\n"; $result = $proxy->addEdition(1, "Example collection edition"); echo "\n\n=== Remove Edition:\n\n"; $result = $proxy->removeEdition(1); echo "\n\n=== Editions:\n\n"; var_export($result); $result = $proxy->getCollectionEditions(); echo "\n\n=== Editions:\n\n"; var_export($result); echo "\n\n=== Account editions:\n\n"; $result = $proxy->getEditionsOfAccount("oxid0");
<?php require_once '../hessian/HessianClient.php'; require_once './gametool.inc.php'; require_once './ServerVersion.inc.php'; $url = 'http://localhost:8088/gametool'; // gametool is protected by username/pwd $options = array('username' => 'admin', 'password' => '1'); $version = 5; $serverVer = new ServerVersion($url, 'hessian/account.api', $options); $path = $serverVer->getVersionPath($version); if (empty($path)) { die("Failed to determine path to account api version {$version}"); } $proxy = new HessianClient($url . $path, $options); registerGametoolMethods($url . $path); $shard = iconv('Windows-1251', 'UTF-8', "shard_gametool_тест"); $items = array(); $items[0] = new ItemToSend(); $items[0]->shard = $shard; $items[0]->avatarId = 1; $items[0]->itemResourceId = 2; $items[0]->runeResourceId = 3; $items[0]->stackCount = 4; $items[0]->counter = 5; $items[0]->senderName = "kolya"; $items[0]->subject = "Hellou"; $items[0]->body = "HowAreYou"; $items[1] = new ItemToSend(); $items[1]->shard = $shard; $items[1]->avatarId = 2;
require_once './gametool.inc.php'; require_once './ServerVersion.inc.php'; require_once './config.php'; require_once './timelineCfg.inc.php'; function datetimeToTimestamp($dateTime) { $ts = strtotime($dateTime); if ($ts < 0 || $ts === FALSE || strftime("%Y-%m-%d %H:%M:%S", $ts) != $dateTime) { die("Failed to parse from datettime: " . $dateTime); } return $ts; } $url = $url = 'http://' . $config['gametool_host'] . ':' . $config['gametool_port'] . '/gametool'; // gametool is protected by username/pwd $options = array('username' => $config['gametool_user'], 'password' => $config['gametool_pwd']); $version = 2; $serverVer = new ServerVersion($url, 'hessian/account.api', $options); $path = $serverVer->getVersionPath($version); if (empty($path)) { die("Failed to determine path to account api version {$version}"); } $proxy = new HessianClient($url . $path, $options); registerGametoolMethods($url); $fromTs = datetimeToTimestamp($timelineCfg['from']); $tillTs = datetimeToTimestamp($timelineCfg['till']); $result = $proxy->getShardCCUTimeline($timelineCfg['shard_name'], $fromTs, $tillTs, $timelineCfg['step_seconds']); $csv = fopen($timelineCfg['csv_file_name'], "w"); foreach ($result as $sample) { fputs($csv, strftime("%Y-%m-%d %H:%M:%S", $sample->timeSeconds) . $timelineCfg['separator'] . ' ' . $sample->ccu . "\n"); } fclose($csv);
<?php require_once '../hessian/HessianClient.php'; require_once './gametool.inc.php'; require_once './ServerVersion.inc.php'; $url = 'http://localhost:8080/gametool'; // gametool is protected by username/pwd $options = array('username' => 'vzlobin', 'password' => '1'); $version = 1; $serverVer = new ServerVersion($url, 'hessian/account.api', $options); $path = $serverVer->getVersionPath($version); if (empty($path)) { die("Failed to determine path to account api version {$version}"); } $proxy = new HessianClient($url . $path, $options); registerGametoolMethods($url . $path); // determine all shards known to gametool $result = $proxy->getAllShards(); echo "Shards =\n"; foreach ($result as $shard) { echo " {$shard}\n"; } // request avatars of account // also demonstrate how we can work with Russian-named elements, assuming that php script is in cp1251 encoding $account = 'вататар'; $result = $proxy->getAvatars(iconv('Windows-1251', 'UTF-8', $account)); echo "Avatars of {$account}=\n"; foreach ($result as $avatar) { echo " {$avatar->getAvatar()}\n"; var_export($avatar); }
<?php require_once '../hessian/HessianClient.php'; require_once './gametool.inc.php'; require_once './ServerVersion.inc.php'; $url = 'http://localhost:8080/gametool'; // gametool is protected by username/pwd $options = array('username' => 'vzlobin', 'password' => '1'); $version = 1; $serverVer = new ServerVersion($url, 'hessian/resource.api', $options); $path = $serverVer->getVersionPath($version); if (empty($path)) { die("Failed to determine path to resource api version {$version}"); } $proxy = new HessianClient($url . $path, $options); registerGametoolResourceMethods($url . $path); $result = $proxy->getResource(1); var_export($result);