当前位置: 首页>>代码示例>>PHP>>正文


PHP XML_RPC_Client类代码示例

本文整理汇总了PHP中XML_RPC_Client的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Client类的具体用法?PHP XML_RPC_Client怎么用?PHP XML_RPC_Client使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XML_RPC_Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendRPC

 /**
  * @access private
  * @static
  */
 function sendRPC($method, $params = array())
 {
     global $mwBlockerHost, $mwBlockerPort, $mwBlockerDebug;
     $client = new XML_RPC_Client('/Blocker', $mwBlockerHost, $mwBlockerPort);
     if ($mwBlockerDebug) {
         $client->debug = true;
     }
     $rpcParams = array_map(array('MWBlocker', 'outParam'), $params);
     $message = new XML_RPC_Message($method, $rpcParams);
     wfSuppressWarnings();
     $start = wfTime();
     $result = $client->send($message);
     $delta = wfTime() - $start;
     wfRestoreWarnings();
     $debug = sprintf("MWBlocker::sendRPC for %s took %0.2fms\n", $method, $delta * 1000.0);
     wfDebug($debug);
     if ($mwBlockerDebug) {
         echo $debug;
     }
     if (!is_object($result)) {
         throw new MWException("Unknown XML-RPC error");
     } elseif ($result->faultCode()) {
         throw new MWException($result->faultCode() . ': ' . $result->faultString());
     } else {
         $value = $result->value();
         return $value->getval();
     }
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:32,代码来源:MWBlocker.php

示例2: onLoad

 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->isPostBack) {
         $deviceId = $this->Request["deviceId"];
         $cmd = $this->db->createCommand("SELECT * FROM `hr_horux_media` WHERE id_device=:id");
         $cmd->bindParameter(":id", $deviceId, PDO::PARAM_STR);
         $row = $cmd->query();
         $row = $row->read();
         require_once 'XML/RPC.php';
         $client = new XML_RPC_Client("RPC2", $row["ip"], $row["port"]);
         $msg = new XML_RPC_Message("horuxInfoDisplay.getMediaList");
         @($response = $client->send($msg));
         if ($response) {
             if (!$response->faultCode()) {
                 $v = $response->value();
                 $result = explode(",", html_entity_decode($v->scalarval()));
                 $media = array();
                 foreach ($result as $k => $v) {
                     $media[] = array("Value" => $v, "Text" => $v);
                 }
                 $this->media->DataTextField = 'Text';
                 $this->media->DataValueField = 'Value';
                 $this->media->DataSource = $media;
                 $this->media->dataBind();
                 if (count($media) > 0) {
                     $this->media->setSelectedIndex(0);
                 }
             } else {
                 $content_error = "ERROR - ";
                 $content_error .= "Code: " . $response->faultCode() . " Reason '" . $response->faultString() . "'<br/>";
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:35,代码来源:addMedia.php

示例3: format

 /**
  * function that takes an address object and gets the latitude / longitude for this
  * address. Note that at a later stage, we could make this function also clean up
  * the address into a more valid format
  *
  * @param object $address
  *
  * @return boolean true if we modified the address, false otherwise
  * @static
  */
 function format(&$values)
 {
     require_once 'CRM/Utils/Address.php';
     // we need a valid zipcode, state and country, else we ignore
     if (!CRM_Utils_Array::value('postal_code', $values) && !CRM_Utils_Array::value('state_province', $values) && !CRM_Utils_Array::value('country', $values)) {
         return false;
     }
     if ($values['country'] != 'United States') {
         return false;
     }
     $string = CRM_Utils_Address::format($values);
     $string = str_replace("\n", ', ', $string);
     if (!$string) {
         return false;
     }
     $params = array(new XML_RPC_Value($string, 'string'));
     $message = new XML_RPC_Message('geocode', $params);
     $client = new XML_RPC_Client($GLOBALS['_CRM_UTILS_GEOCODE_RPC']['_uri'], $GLOBALS['_CRM_UTILS_GEOCODE_RPC']['_server']);
     $response = $client->send($message);
     if (!$response && !$response->faultCode()) {
         return false;
     }
     $data = XML_RPC_decode($response->value());
     if (!CRM_Utils_Array::value(0, $data)) {
         return false;
     }
     $data = $data[0];
     $values['geo_code_1'] = $data['lat'];
     $values['geo_code_2'] = $data['long'];
     return true;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:41,代码来源:RPC.php

示例4: getFromOrigin

/**
 * This is the core XML-RPC client it takes the parameters passed in and bundles them up
 * and sends them as an XML-RPC request to the origin server, which processes them against
 * the central database and passes the results back to this client
 *
 * @param string $function  The name of the remote origin function to be called
 * @param array  $params    An array of the parameters to be passed to the origin function
 * @return mixed            The decoded response from the origin server
 */
function getFromOrigin($function, $params)
{
    /**
     * @package    MaxDal
     * @subpackage Delivery
     * @author     Chris Nutting <chris@m3.net>
     *
     */
    $conf = $GLOBALS['_MAX']['CONF'];
    // Create an XML-RPC client to talk to the XML-RPC server
    $client = new XML_RPC_Client($conf['origin']['script'], $conf['origin']['host'], $conf['origin']['port']);
    $message = new XML_RPC_Message($function, array());
    // Add the parameters to the message
    $message->addParam(new XML_RPC_Value($params, $GLOBALS['XML_RPC_String']));
    // Send the XML-RPC message to the server
    $response = $client->send($message, $conf['origin']['timeout'], $conf['origin']['protocol']);
    if (!$response || $response->faultCode() != 0) {
        if (defined('OA_DELIVERY_CACHE_FUNCTION_ERROR')) {
            return OA_DELIVERY_CACHE_FUNCTION_ERROR;
        } else {
            return null;
        }
    } else {
        // Decode the serialized response
        $value = $response->value();
        $value = $value->scalarval();
        $value = unserialize($value);
    }
    return $value;
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:39,代码来源:xmlrpc.php

示例5: drawMachines

function drawMachines()
{
    $cli = new XML_RPC_Client('/RPCSERVER', $_SESSION["host"], $_SESSION["port"]);
    $req = new XML_RPC_Value(array("sut_username" => new XML_RPC_Value($_SESSION['username'], 'string')), "struct");
    $msg = new XML_RPC_Message('listMachines', array($req));
    $resp = $cli->send($msg);
    if (hasErrors($resp)) {
        return;
    }
    $machines = $resp->value();
    $i = $machines->arraysize();
    while ($i--) {
        $m = XML_RPC_decode($machines->arraymem($i));
        echo "<form name='{$m}' action='set_config.php?SUT_MACHINE={$m}' method='post'>\n        <ul class='menu' >\n        <li >\n        <p  onclick='javascript:toggleSpan(\"span{$m}\");' >{$m}<br/><span id='span{$m}'>{$m}\n        <a href='javascript:;' onclick='addEvent(\"span{$m}\", \"sName{$m}\", \"sValue{$m}\");'><em class='butt'>Add</em></a>\n        <input type='submit' value='Save'><br style='clear:both'>\n        <a href='setup_machine.php?machine={$m}'><em class='butt'>Setup</em></a>\n        <a href='start_manager.php?machine={$m}'><input type='button' value='StartManager'></a><br>\n\n        <input id='sName{$m}'  type='text' value='SUT_NAME' style='clear:both; float:left; width:25%;'/>\n        <input id='sValue{$m}' type='text' value='Value'/><br>";
        $params = new XML_RPC_Value(array("sut_username" => new XML_RPC_Value($_SESSION['username'], 'string'), "sut_machine" => new XML_RPC_Value($m, 'string')), "struct");
        $msg = new XML_RPC_Message('getConfig', array($params));
        $resp = $cli->send($msg);
        if (hasErrors($resp)) {
            return;
        }
        $cfgTable = $resp->value();
        $j = $cfgTable->arraysize();
        while ($j--) {
            $cfgEntry = $cfgTable->arraymem($j);
            $cfgEntry->structreset();
            $symbol = XML_RPC_decode($cfgEntry->structmem("symbol"));
            $value = XML_RPC_decode($cfgEntry->structmem("val"));
            echo "<b>{$symbol}</b>";
            echo "<input type='text' name='{$symbol}' value='{$value}' /><br>\n";
        }
        echo " </span></p>\n            </li> </ul> </form>";
    }
}
开发者ID:BackupTheBerlios,项目名称:bee-svn,代码行数:33,代码来源:machines.php

示例6: grabTracWikiPageHTML

 /**
  * Method to get a specific wiki page in HTML
  *
  * @param string $pagename
  * @return string HTML
  */
 public function grabTracWikiPageHTML($pagename)
 {
     $msg = new XML_RPC_Message('wiki.getPageHTML', array(new XML_RPC_Value($pagename, "string")));
     $cli = new XML_RPC_Client($this->tracURL, $this->tracServ);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_filters_commserr", "filters") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         $val = XML_RPC_decode($val);
         if (is_array($val)) {
             return $val['faultString'];
         } else {
             return $val;
         }
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_filters_faultcode", "filters") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_filters_faultreason", "filters") . ": " . $resp->faultString());
     }
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:33,代码来源:tracrpcclient_class_inc.php

示例7: fullGraph

 /**
  * Method to get a specific wiki page in HTML
  *
  * @param string $pagename
  * @return string HTML
  */
 public function fullGraph()
 {
     $msg = new XML_RPC_Message('dlGraphFull');
     $pserv = $this->objSysConfig->getValue('package_server', 'packages');
     $purl = $this->objSysConfig->getValue('package_url', 'packages');
     $cli = new XML_RPC_Client($purl, $pserv);
     $cli->setDebug(0);
     // send the request message
     $resp = $cli->send($msg);
     if (!$resp) {
         throw new customException($this->objLanguage->languageText("mod_filters_commserr", "filters") . ": " . $cli->errstr);
         exit;
     }
     if (!$resp->faultCode()) {
         $val = $resp->value();
         $val = XML_RPC_decode($val);
         if (is_array($val)) {
             return $val['faultString'];
         } else {
             return $val;
         }
     } else {
         /*
          * Display problems that have been gracefully caught and
          * reported by the xmlrpc server class.
          */
         throw new customException($this->objLanguage->languageText("mod_filters_faultcode", "filters") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_filters_faultreason", "filters") . ": " . $resp->faultString());
     }
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:35,代码来源:poprpcclient_class_inc.php

示例8: onReloadDisplay

 public function onReloadDisplay($sender, $param)
 {
     require_once 'XML/RPC.php';
     $client = new XML_RPC_Client("RPC2", "localhost", 7000);
     $msg = new XML_RPC_Message("horuxInfoDisplay.reload");
     @($response = $client->send($msg));
 }
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:7,代码来源:mediaList.php

示例9: drawMachines

function drawMachines()
{
    $cli = new XML_RPC_Client('/RPCSERVER', 'localhost', 5000);
    $msg = new XML_RPC_Message('listMachines');
    $resp = $cli->send($msg);
    if (hasErrors($resp)) {
        return;
    }
    $machines = $resp->value();
    $i = $machines->arraysize();
    #$i = 1;
    while ($i--) {
        $m = XML_RPC_decode($machines->arraymem($i));
        echo "<form name='{$m}' action='set_config.php?SUT_MACHINE={$m}' method='post'> <ul id='menu'>\n        <li ><p>{$m}\n        <span id='span{$m}'>\n        <a href='javascript:;' onclick='addEvent(\"span{$m}\", \"sName{$m}\", \"sValue{$m}\");'><em class='butt'>Add</em></a>\n        <input type='submit' value='Save'>\n\n        <input id='sName{$m}'  type='text' value='SUT_NAME' style='text-align:right; clear:both; float:left; width:12em;'/>\n        <input id='sValue{$m}' type='text' value='Value'/>\n\n\n        ";
        $params = array(new XML_RPC_Value($m, 'string'));
        $msg = new XML_RPC_Message('getConfig', $params);
        $resp = $cli->send($msg);
        if (hasErrors($resp)) {
            return;
        }
        $cfgTable = $resp->value();
        $j = $cfgTable->arraysize();
        while ($j--) {
            $cfgEntry = $cfgTable->arraymem($j);
            $cfgEntry->structreset();
            $symbol = XML_RPC_decode($cfgEntry->structmem("symbol"));
            $value = XML_RPC_decode($cfgEntry->structmem("val"));
            echo "<b>{$symbol}</b>";
            echo "<input type='text' name='{$symbol}' value='{$value}' /><br>\n";
        }
        echo "\n\n        </span></p>\n            </li>\n            </ul>\n\n</form>";
    }
}
开发者ID:BackupTheBerlios,项目名称:bee-svn,代码行数:33,代码来源:base_lib.php

示例10: createPublisher

 function createPublisher($sessionId, $publisherName)
 {
     // Add new Publisher
     $oPublisher = new XML_RPC_VALUE(array('agencyid' => new XML_RPC_Value(1, 'int'), 'publisherName' => new XML_RPC_Value($publisherName, 'string'), 'contactName' => new XML_RPC_Value('Ian', 'string'), 'emailAddress' => new XML_RPC_Value('ian@reatlimematrix.com', 'string'), 'username' => new XML_RPC_Value('rishad', 'string'), 'password' => new XML_RPC_Value('rishad', 'string')), 'struct');
     $aParams1 = array(new XML_RPC_Value($sessionId, 'string'), $oPublisher);
     $oMessage1 = new XML_RPC_Message('addPublisher', $aParams1);
     $oClient1 = new XML_RPC_Client($this->publisherRpcWebServiceUrl, $this->xmlRpcHost);
     $oResponse1 = $oClient1->send($oMessage1);
     $publisherID = $this->returnXmlRpcResponseData($oResponse1);
     echo 'Publisher' . $publisherID . '<br>';
     return $publisherID;
 }
开发者ID:rayku,项目名称:rayku,代码行数:12,代码来源:xml.php

示例11: get_firmware_version

function get_firmware_version($return_php = true)
{
    global $g;
    $versioncheck_base_url = "www.pfsense.com";
    $versioncheck_path = "/pfSense/xmlrpc.php";
    $params = array("pkg" => 'all', "info" => array('version', 'name'));
    $msg = new XML_RPC_Message('pfsense.get_pkgs', array(php_value_to_xmlrpc($params)));
    $cli = new XML_RPC_Client($versioncheck_path, $versioncheck_base_url);
    $resp = $cli->send($msg);
    $raw_versions = $resp->value();
    return xmlrpc_value_to_php($raw_versions);
}
开发者ID:hynnet,项目名称:xmlrpc-server,代码行数:12,代码来源:pkg_tester.php

示例12: get_firmware_version

function get_firmware_version($return_php = true)
{
    global $g;
    $versioncheck_base_url = "packages.pfsense.org";
    $versioncheck_path = "/xmlrpc.php";
    $params = array("pkg" => 'all', "info" => array('version', 'name'), "freebsd_version" => "10", "freebsd_machine" => "amd64");
    $msg = new XML_RPC_Message('pfsense.get_pkgs', array(php_value_to_xmlrpc($params)));
    $cli = new XML_RPC_Client($versioncheck_path, $versioncheck_base_url);
    $resp = $cli->send($msg);
    $raw_versions = $resp->value();
    return xmlrpc_value_to_php($raw_versions);
}
开发者ID:OpenTouch,项目名称:xmlrpc-server,代码行数:12,代码来源:pkg_tester.php

示例13: setData

 protected function setData()
 {
     $cmd = $this->db->createCommand("SELECT * FROM hr_horux_media_media WHERE id=:id");
     $cmd->bindParameter(":id", $this->id->Value, PDO::PARAM_INT);
     $query = $cmd->query();
     if ($query) {
         $data = $query->read();
         $this->id->Value = $data['id'];
         $this->name->Text = $data['name'];
         $deviceId = $data['id_device'];
         $cmd = $this->db->createCommand("SELECT * FROM `hr_horux_media` WHERE id_device=:id");
         $cmd->bindParameter(":id", $deviceId, PDO::PARAM_STR);
         $row = $cmd->query();
         $row = $row->read();
         require_once 'XML/RPC.php';
         $client = new XML_RPC_Client("RPC2", $row["ip"], $row["port"]);
         $msg = new XML_RPC_Message("horuxInfoDisplay.getMediaList");
         @($response = $client->send($msg));
         if ($response) {
             if (!$response->faultCode()) {
                 $v = $response->value();
                 $result = explode(",", html_entity_decode($v->scalarval()));
                 $media = array();
                 foreach ($result as $k => $v) {
                     $media[] = array("Value" => $v, "Text" => $v);
                 }
                 $this->media->DataTextField = 'Text';
                 $this->media->DataValueField = 'Value';
                 $this->media->DataSource = $media;
                 $this->media->dataBind();
                 if (count($media) > 0) {
                     $this->media->setSelectedValue($data['path']);
                 }
             } else {
                 $content_error = "ERROR - ";
                 $content_error .= "Code: " . $response->faultCode() . " Reason '" . $response->faultString() . "'<br/>";
             }
         }
         $this->during->Text = $data['time'];
         if ($data['type'] == "IMAGE") {
             $this->picture->setChecked(true);
         }
         if ($data['type'] == "MOVIE") {
             $this->movie->setChecked(true);
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:47,代码来源:modMedia.php

示例14: fetchData

 function fetchData($username, $password)
 {
     $rpc = new XML_RPC_Client('/xmlrpc.php', 'pear.php.net');
     $rpc_message = new XML_RPC_Message("user.info", array(new XML_RPC_Value($username, "string")));
     // Error Checking howto ???
     $result = $rpc->send($rpc_message);
     $value = $result->value();
     $userinfo = xml_rpc_decode($value);
     if ($userinfo['password'] == md5($password)) {
         $this->activeUser = $userinfo['handle'];
         foreach ($userinfo as $uk => $uv) {
             $this->_auth_obj->setAuthData($uk, $uv);
         }
         return true;
     }
     return false;
 }
开发者ID:laiello,项目名称:coopcrucial,代码行数:17,代码来源:PEAR.php

示例15: sendPing

 function sendPing()
 {
     if (!$this->Commonping_Target) {
         return false;
     }
     // parse URL
     $parsedURL = parse_url($this->Commonping_Target);
     // send ping
     $client = new XML_RPC_Client($parsedURL["path"], $parsedURL["host"], 80);
     $this->Server_Response = $client->send($this->Ping_XML);
     // result
     if (get_class($this->Server_Response) == strtolower("XML_RPC_Response") && $this->Server_Response->faultCode() == false) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:17,代码来源:class.commonping.php


注:本文中的XML_RPC_Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。