當前位置: 首頁>>代碼示例>>PHP>>正文


PHP xmlrpc_client::send方法代碼示例

本文整理匯總了PHP中xmlrpc_client::send方法的典型用法代碼示例。如果您正苦於以下問題:PHP xmlrpc_client::send方法的具體用法?PHP xmlrpc_client::send怎麽用?PHP xmlrpc_client::send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xmlrpc_client的用法示例。


在下文中一共展示了xmlrpc_client::send方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: callRemote

 function callRemote($method)
 {
     // Curl is required so generate a fault if curl functions cannot be found.
     if (!$this->curl) {
         return array('faultCode' => -1, 'faultString' => 'Curl functions are unavailable.');
     }
     // The first argument will always be the method name while all remaining arguments need
     // to be passed along with the call.
     $args = func_get_args();
     array_shift($args);
     if ($this->xmlrpc) {
         // If php has xmlrpc support use the built in functions.
         $request = xmlrpc_encode_request($method, $args);
         $result = $this->__xmlrpc_call($request);
         $decodedResult = xmlrpc_decode($result);
     } else {
         // If no xmlrpc support is found, use the phpxmlrpc library. This involves containing
         // all variables inside the xmlrpcval class.
         $encapArgs = array();
         foreach ($args as $arg) {
             $encapArgs[] = $this->__phpxmlrpc_encapsulate($arg);
         }
         $msg = new xmlrpcmsg($method, $encapArgs);
         $client = new xmlrpc_client($this->url);
         $client->verifypeer = false;
         $result = $client->send($msg);
         if ($result->errno) {
             $decodedResult = array('faultCode' => $result->errno, 'faultString' => $result->errstr);
         } else {
             $decodedResult = php_xmlrpc_decode($result->value());
         }
     }
     return $decodedResult;
 }
開發者ID:laiello,項目名稱:we-promote-this,代碼行數:34,代碼來源:class.RevverAPI.php

示例2: testCurlKAErr

 public function testCurlKAErr()
 {
     if (!function_exists('curl_init')) {
         $this->markTestSkipped('CURL missing: cannot test curl keepalive errors');
         return;
     }
     $m = new xmlrpcmsg('examples.stringecho', array(new xmlrpcval('hello', 'string')));
     // test 2 calls w. keepalive: 1st time connection ko, second time ok
     $this->client->server .= 'XXX';
     $this->client->keepalive = true;
     $r = $this->client->send($m, 5, 'http11');
     // in case we have a "universal dns resolver" getting in the way, we might get a 302 instead of a 404
     $this->assertTrue($r->faultCode() === 8 || $r->faultCode() == 5);
     // now test a successful connection
     $server = explode(':', $this->args['LOCALSERVER']);
     if (count($server) > 1) {
         $this->client->port = $server[1];
     }
     $this->client->server = $server[0];
     $this->client->path = $this->args['URI'];
     $r = $this->client->send($m, 5, 'http11');
     $this->assertEquals(0, $r->faultCode());
     $ro = $r->value();
     is_object($ro) && $this->assertEquals('hello', $ro->scalarVal());
 }
開發者ID:TsobuEnterprise,項目名稱:phpxmlrpc,代碼行數:25,代碼來源:2InvalidHostTest.php

示例3: pingWeblogs

function pingWeblogs($name, $url, $server)
{
    global $Paths;
    if (strpos($server, "http://") === false) {
        $server = "http://" . $server;
    }
    $server = parse_url($server);
    if ($server['path'] == "") {
        $server['path'] = "/";
    }
    if ($server['port'] == "") {
        $server['port'] = "80";
    }
    printf("<p><b>%s:%s%s</b>:<br />", $server['host'], $server['port'], $server['path']);
    flush();
    $client = new xmlrpc_client($server['path'], $server['host'], $server['port']);
    $message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($name), new xmlrpcval($url)));
    $result = $client->send($message);
    if (!$result || $result->faultCode()) {
        echo "<br />Pivot says: could not send ping. Check if you set the server address correctly, or else the server may be temporarily down. This happens sometimes, and if this error occurs out of the blue, it's likely that it will go away in a few hours or days. <br /></p>";
        echo "<!-- \n";
        print_r($result);
        echo "\n -->\n\n\n";
        return false;
    }
    $msg = $result->serialize();
    $msg = preg_replace('#.*<name>message</name>[^<]*<value>(.*?)</value>.*#si', '$1', $msg);
    // Stripping off any tags in the message value - typically the string element
    $msg = strip_tags($msg);
    $msg = escape($msg);
    echo "Server said: <i>'{$msg}'</i><br /></p>";
    return true;
}
開發者ID:wborbajr,項目名稱:TecnodataApp,代碼行數:33,代碼來源:ping.php

示例4: um_xml_rpc_client_call

function um_xml_rpc_client_call($server_host, $server_path, $server_port, $proxy, $proxy_port, $proxy_user, $proxy_pass, $function, $parameters)
{
    $msg = new xmlrpcmsg($function, $parameters);
    $client = new xmlrpc_client($server_path, $server_host, $server_port);
    $client->setProxy($proxy, $proxy_port, $proxy_user, $proxy_pass);
    if (defined('XMLRPC_DEBUG')) {
        $client->setDebug(XMLRPC_DEBUG);
    }
    $result = $client->send($msg, XMLRPC_TIMEOUT, '');
    if (!$result) {
        trigger_error('<strong>Open Update Manager</strong> Server comunication error. ' . $client->errstr);
        return 0;
    }
    switch ($result->faultCode()) {
        case 0:
            break;
        case 5:
            trigger_error('<strong>Open Update Manager</strong> Server comunication error. ' . $result->faultString());
            return 0;
        default:
            trigger_error('<strong>Open Update Manager</strong> XML-RPC error. ' . $result->faultString());
            return 0;
    }
    return $result;
}
開發者ID:dsyman2,項目名稱:integriaims,代碼行數:25,代碼來源:libupdate_manager_client.php

示例5: phpAds_checkForUpdates

function phpAds_checkForUpdates($already_seen = 0, $send_sw_data = true)
{
    global $phpAds_config, $phpAds_updatesServer;
    global $xmlrpcerruser;
    // Create client object
    $client = new xmlrpc_client($phpAds_updatesServer['script'], $phpAds_updatesServer['host'], $phpAds_updatesServer['port']);
    $params = array(new xmlrpcval($GLOBALS['phpAds_productname'], "string"), new xmlrpcval($phpAds_config['config_version'], "string"), new xmlrpcval($already_seen, "string"), new xmlrpcval($phpAds_config['updates_dev_builds'] ? 'dev' : '', "string"), new xmlrpcval($phpAds_config['instance_id'], "string"));
    if ($send_sw_data) {
        // Prepare software data
        $params[] = phpAds_xmlrpcEncode(array('os_type' => php_uname('s'), 'os_version' => php_uname('r'), 'webserver_type' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^(.*?)/.*$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'webserver_version' => isset($_SERVER['SERVER_SOFTWARE']) ? preg_replace('#^.*?/(.*?)(?: .*)?$#', '$1', $_SERVER['SERVER_SOFTWARE']) : '', 'db_type' => $GLOBALS['phpAds_dbmsname'], 'db_version' => phpAds_dbResult(phpAds_dbQuery("SELECT VERSION()"), 0, 0), 'php_version' => phpversion(), 'php_sapi' => ucfirst(php_sapi_name()), 'php_extensions' => get_loaded_extensions(), 'php_register_globals' => (bool) ini_get('register_globals'), 'php_magic_quotes_gpc' => (bool) ini_get('magic_quotes_gpc'), 'php_safe_mode' => (bool) ini_get('safe_mode'), 'php_open_basedir' => (bool) strlen(ini_get('open_basedir')), 'php_upload_tmp_readable' => (bool) is_readable(ini_get('upload_tmp_dir') . DIRECTORY_SEPARATOR)));
    }
    // Create XML-RPC request message
    $msg = new xmlrpcmsg("Openads.Sync", $params);
    // Send XML-RPC request message
    if ($response = $client->send($msg, 10)) {
        // XML-RPC server found, now checking for errors
        if (!$response->faultCode()) {
            $ret = array(0, phpAds_xmlrpcDecode($response->value()));
            // Prepare cache
            $cache = $ret[1];
        } else {
            $ret = array($response->faultCode(), $response->faultString());
            // Prepare cache
            $cache = false;
        }
        // Save to cache
        phpAds_dbQuery("\n\t\t\tUPDATE\n\t\t\t\t" . $phpAds_config['tbl_config'] . "\n\t\t\tSET\n\t\t\t\tupdates_cache = '" . addslashes(serialize($cache)) . "',\n\t\t\t\tupdates_timestamp = " . time() . "\n\t\t");
        return $ret;
    }
    return array(-1, 'No response from the server');
}
開發者ID:henryhe514,項目名稱:ChineseCommercial,代碼行數:31,代碼來源:lib-openadssync.inc.php

示例6: connect

function connect()
{
    global $oerpuser, $oerppwd, $dbname, $server_url, $client;
    if (isset($_COOKIE["user_id"]) == true) {
        if ($_COOKIE["user_id"] > 0) {
            return $_COOKIE["user_id"];
        }
    }
    try {
        $sock = new xmlrpc_client($server_url . 'common');
        $msg = new xmlrpcmsg('login');
        $msg->addParam(new xmlrpcval($dbname, "string"));
        $msg->addParam(new xmlrpcval($oerpuser, "string"));
        $msg->addParam(new xmlrpcval($oerppwd, "string"));
        $resp = $sock->send($msg);
        $val = $resp->value();
        $id = $val->scalarval();
    } catch (Exception $ex) {
        print "Unable to authenticate to openERP " . $ex->getMessage() . "\n";
    }
    setcookie("user_id", $id, time() + 3600);
    if ($id > 0) {
        return $id;
    } else {
        return -1;
    }
}
開發者ID:rkshakya,項目名稱:RKSProjects,代碼行數:27,代碼來源:openerp.php

示例7: methodCaller

 /**
  * @method methodCaller
  * @description Builds XML and Sends the Call
  * @param string $service
  * @param array $callArray
  * @return int|mixed|string
  * @throws iSDKException
  */
 public function methodCaller($service, $callArray)
 {
     /* Set up the call */
     $call = new xmlrpcmsg($service, $callArray);
     if ($service != 'DataService.getTemporaryKey') {
         array_unshift($call->params, $this->encKey);
     }
     /* Send the call */
     $now = time();
     $start = microtime();
     $result = $this->client->send($call);
     $stop = microtime();
     /* Check the returned value to see if it was successful and return it */
     if (!$result->faultCode()) {
         if ($this->loggingEnabled == 1) {
             $this->log(array('Method' => $service, 'Call' => $callArray, 'Start' => $start, 'Stop' => $stop, 'Now' => $now, 'Result' => $result, 'Error' => 'No', 'ErrorCode' => 'No Error Code Received'));
         }
         return $result->value();
     } else {
         if ($this->loggingEnabled == 1) {
             $this->log(array('Method' => $service, 'Call' => $callArray, 'Start' => $start, 'Stop' => $stop, 'Now' => $now, 'Result' => $result, 'Error' => 'Yes', 'ErrorCode' => "ERROR: " . $result->faultCode() . " - " . $result->faultString()));
         }
         if ($this->debug == "kill") {
             die("ERROR: " . $result->faultCode() . " - " . $result->faultString());
         } elseif ($this->debug == "on") {
             return "ERROR: " . $result->faultCode() . " - " . $result->faultString();
         } elseif ($this->debug == "throw") {
             throw new iSDKException($result->faultString(), $result->faultCode());
         } elseif ($this->debug == "off") {
             //ignore!
         }
     }
 }
開發者ID:pokmot,項目名稱:PHP-iSDK,代碼行數:41,代碼來源:isdk.php

示例8: xmlrpcCall

 function xmlrpcCall($url, $method, $params)
 {
     // xmlrpc encode parameters
     for ($i = 0; $i < count($params); $i++) {
         if (get_class($params[$i]) != 'xmlrpcval') {
             $params[$i] = xmlrpc_encode($params[$i]);
         }
     }
     // send request
     $message = new xmlrpcmsg($method, $params);
     debug("XML-RPC message", $message->serialize());
     $addr = parse_url($url);
     $client = new xmlrpc_client($url, $addr['host'], $addr['port']);
     //if($debug)
     //  $client->setDebug(1);
     debug("XML-RPC", "call to " . $url);
     $response = $client->send($message);
     // process response
     debug("XML-RPC Response", $response->serialize());
     if (!$response) {
         debug("No response", "probably host is unreachable");
     } elseif ($response->faultCode() != 0) {
         // there was an error
         debug("Error response: ", $response->faultCode() . "  " . $response->faultString());
     } else {
         $retval = $response->value();
         if ($retval) {
             $retval = xmlrpc_decode($retval);
         }
         debug("Response", $retval);
         return $retval;
     }
     return NULL;
 }
開發者ID:BackupTheBerlios,項目名稱:sotf-svn,代碼行數:34,代碼來源:rpc_Utils.class.php

示例9: SendRPC

 /**
  * Compiles and sends the Shopatron RPC
  * @param   Varien_Event_Observer $observer
  * @return  MikeRoyer_Shopatron_Model_Observer
  */
 public function SendRPC($observer)
 {
     $server = new xmlrpc_client('/xmlServer.php', 'www.shopatron.com', 80);
     $message = $this->compileRPC();
     $result = $server->send($message);
     // For secure transmission -- did not work for me
     // $result = $server->send($message, 30, 'https');
     $this->DoResult($result, $message);
 }
開發者ID:Rukhsar,項目名稱:mage-shopatron,代碼行數:14,代碼來源:Observer.php

示例10: shutdown

 function shutdown()
 {
     $function = new xmlrpcmsg('control.shutdown', array(php_xmlrpc_encode((string) $this->ktid), php_xmlrpc_encode((string) $this->authToken)));
     $result =& $this->client->send($function);
     if ($result->faultCode()) {
         $this->error($result, 'shutdown');
         return false;
     }
     return true;
 }
開發者ID:sfsergey,項目名稱:knowledgetree,代碼行數:10,代碼來源:XmlRpcLucene.inc.php

示例11: atheme

function atheme($hostname, $port, $path, $sourceip, $username, $password, $service, $command, $params)
{
    $message = new xmlrpcmsg("atheme.login");
    $message->addParam(new xmlrpcval($username, "string"));
    $message->addParam(new xmlrpcval($password, "string"));
    $client = new xmlrpc_client($path, $hostname, $port);
    $response = $client->send($message);
    $session = NULL;
    if (!$response->faultCode()) {
        $session = explode("<string>", $response->serialize());
        $session = explode("</string", $session[1]);
        $session = $session[0];
    } else {
        return "Authorisation failed";
    }
    $message = new xmlrpcmsg("atheme.command");
    $message->addParam(new xmlrpcval($session, "string"));
    $message->addParam(new xmlrpcval($username, "string"));
    $message->addParam(new xmlrpcval($sourceip, "string"));
    $message->addParam(new xmlrpcval($service, "string"));
    $message->addParam(new xmlrpcval($command, "string"));
    if ($params != NULL) {
        if (sizeof($params) < 2) {
            foreach ($params as $param) {
                $message->addParam(new xmlrpcval($param, "string"));
            }
        } else {
            $firstparam = $params[0];
            $secondparam = "";
            for ($i = 1; $i < sizeof($params); $i++) {
                $secondparam .= $params[$i] . " ";
            }
            $message->addParam(new xmlrpcval($firstparam, "string"));
            $message->addParam(new xmlrpcval($secondparam, "string"));
        }
        $response = $client->send($message);
    }
    if (!$response->faultCode()) {
        return $response->serialize();
    } else {
        return "Command failed: " . $response->faultString();
    }
}
開發者ID:byteturtle,項目名稱:atheme,代碼行數:43,代碼來源:atheme.php

示例12: run

 private function run($service, $command, $params)
 {
     if (!$this->ci->config->item('atheme_enabled')) {
         return;
     }
     $hostname = $this->ci->config->item('atheme_server');
     $port = $this->ci->config->item('atheme_port');
     $path = $this->ci->config->item('atheme_path');
     $username = $this->ci->config->item('atheme_username');
     $password = $this->ci->config->item('atheme_password');
     $sourceip = '127.0.0.1';
     $message = new xmlrpcmsg("atheme.login");
     $message->addParam(new xmlrpcval($username, "string"));
     $message->addParam(new xmlrpcval($password, "string"));
     $client = new xmlrpc_client($path, $hostname, $port);
     $response = $client->send($message);
     $session = NULL;
     if (!$response->faultCode()) {
         $session = explode("<string>", $response->serialize());
         $session = explode("</string", $session[1]);
         $session = $session[0];
     } else {
         return "Authorization failed";
     }
     $message = new xmlrpcmsg("atheme.command");
     $message->addParam(new xmlrpcval($session, "string"));
     $message->addParam(new xmlrpcval($username, "string"));
     $message->addParam(new xmlrpcval($sourceip, "string"));
     $message->addParam(new xmlrpcval($service, "string"));
     $message->addParam(new xmlrpcval($command, "string"));
     if ($params != NULL) {
         foreach ($params as $param) {
             $message->addParam(new xmlrpcval($param, "string"));
         }
         $response = $client->send($message);
     }
     if (!$response->faultCode()) {
         return $response->serialize();
     } else {
         return "Command failed: " . $response->faultString();
     }
 }
開發者ID:nodecast,項目名稱:projectNarwhal,代碼行數:42,代碼來源:atheme.php

示例13: ItemSendPing

 /**
  * Ping the pingomatic RPC service.
  */
 function ItemSendPing(&$params)
 {
     global $debug;
     $item_Blog = $params['Item']->get_Blog();
     $client = new xmlrpc_client('/', 'rpc.pingomatic.com', 80);
     $client->debug = $debug && $params['display'];
     $message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($item_Blog->get('name')), new xmlrpcval($item_Blog->get('url'))));
     $result = $client->send($message);
     $params['xmlrpcresp'] = $result;
     return true;
 }
開發者ID:ldanielz,項目名稱:uesp.blog,代碼行數:14,代碼來源:_ping_pingomatic.plugin.php

示例14:

 function &send($msg, $timeout = 0, $method = '')
 {
     if (empty($method)) {
         $method = $this->method;
     }
     if ($method != 'file' and $method != 'unix' and $method != 'socket') {
         parent::send($msg, $timeout = 0, $method = '');
     } else {
         $r =& $this->sendPayloadUNIX($msg);
     }
     return $r;
 }
開發者ID:alienff,項目名稱:wtorrent,代碼行數:12,代碼來源:xmlrpc_unix.inc.php

示例15: xmlrpcmsg

 function send_message($name, $params, $url)
 {
     $msg = new xmlrpcmsg($name, $params);
     $client = new xmlrpc_client($url);
     $client->return_type = 'phpvals';
     $result = $client->send($msg);
     if (!$result->faultCode()) {
         return $result->value();
     } else {
         throw new SilkXmlRpcException($result->faultString(), $result->faultCode());
     }
 }
開發者ID:JackSpratt,項目名稱:silk,代碼行數:12,代碼來源:class.silk_xmlrpc.php


注:本文中的xmlrpc_client::send方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。