• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xmlrpc_encode_request函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: query

 public function query($method, $parameters = null)
 {
     $request = xmlrpc_encode_request($method, $parameters);
     $headers = array("Content-type: text/xml", "Content-length: " . strlen($request));
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $this->url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
     if ($this->timeout) {
         curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout);
     }
     $rawResponse = curl_exec($curl);
     $curlErrno = curl_errno($curl);
     $curlError = curl_error($curl);
     curl_close($curl);
     if ($curlErrno) {
         throw new NetworkException($curlError, $curlErrno);
     }
     $result = xmlrpc_decode($rawResponse);
     if (xmlrpc_is_fault($result)) {
         throw new NetworkException($result['faultString'], $result['faultCode']);
     }
     return $result;
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:25,代码来源:XmlRpcClient.class.php


示例2: 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


示例3: get_request

 static function get_request($method, $params = CJ_EMPTY_VALUE, $params2 = CJ_EMPTY_VALUE, $params3 = CJ_EMPTY_VALUE, $params4 = CJ_EMPTY_VALUE, $params5 = CJ_EMPTY_VALUE)
 {
     if ($params == CJ_EMPTY_VALUE) {
         $request = xmlrpc_encode_request("joomdle_" . $method, array(), array('encoding' => 'utf8'));
     } else {
         if ($params2 == CJ_EMPTY_VALUE) {
             $request = xmlrpc_encode_request("joomdle_" . $method, array($params), array('encoding' => 'utf8'));
         } else {
             if ($params3 == CJ_EMPTY_VALUE) {
                 $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2), array('encoding' => 'utf8'));
             } else {
                 if ($params4 == CJ_EMPTY_VALUE) {
                     $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2, $params3), array('encoding' => 'utf8'));
                 } else {
                     if ($params5 == CJ_EMPTY_VALUE) {
                         $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2, $params3, $params4), array('encoding' => 'utf8'));
                     } else {
                         $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2, $params3, $params4, $params5), array('encoding' => 'utf8'));
                     }
                 }
             }
         }
     }
     return $request;
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:25,代码来源:content.php


示例4: rpc_send

 /**
  * send xml data to OpenNebula RPC server
  * @param $method
  * @param $argument
  */
 function rpc_send($method, $argument)
 {
     //Using the XML-RPC extension to format the XML package
     $request = xmlrpc_encode_request($method, $argument);
     $req = curl_init($this->service_url);
     //Using the cURL extension to send it off,  first creating a custom header block
     $headers = array();
     array_push($headers, "Content-Type: text/xml");
     array_push($headers, "Content-Length: " . strlen($request));
     array_push($headers, "\r\n");
     //URL to post to
     curl_setopt($req, CURLOPT_URL, $this->service_url);
     //Setting options for a secure SSL based xmlrpc server
     curl_setopt($req, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($req, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($req, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($req, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($req, CURLOPT_POSTFIELDS, $request);
     //Finally run
     $response = curl_exec($req);
     //Close the cURL connection
     curl_close($req);
     //Decoding the response to be displayed
     $result = xmlrpc_decode($response);
     return $result;
 }
开发者ID:jjdevx,项目名称:one-console,代码行数:32,代码来源:class.one.php


示例5: get_request

 static function get_request($method, $params = CJ_EMPTY_VALUE, $params2 = CJ_EMPTY_VALUE, $params3 = CJ_EMPTY_VALUE, $params4 = CJ_EMPTY_VALUE, $params5 = CJ_EMPTY_VALUE)
 {
     $comp_params = JComponentHelper::getParams('com_joomdle');
     switch ($comp_params->get('moodle_version')) {
         case 20:
             if ($params == CJ_EMPTY_VALUE) {
                 $request = xmlrpc_encode_request("joomdle_" . $method, array(), array('encoding' => 'utf8'));
             } else {
                 if ($params2 == CJ_EMPTY_VALUE) {
                     $request = xmlrpc_encode_request("joomdle_" . $method, array($params), array('encoding' => 'utf8'));
                 } else {
                     if ($params3 == CJ_EMPTY_VALUE) {
                         $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2), array('encoding' => 'utf8'));
                     } else {
                         if ($params4 == CJ_EMPTY_VALUE) {
                             $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2, $params3), array('encoding' => 'utf8'));
                         } else {
                             if ($params5 == CJ_EMPTY_VALUE) {
                                 $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2, $params3, $params4), array('encoding' => 'utf8'));
                             } else {
                                 $request = xmlrpc_encode_request("joomdle_" . $method, array($params, $params2, $params3, $params4, $params5), array('encoding' => 'utf8'));
                             }
                         }
                     }
                 }
             }
             break;
         case 19:
             $request = xmlrpc_encode_request("auth/joomdle/auth.php/{$method}", array($params, $params2, $params3, $params4, $params5));
             //, array ('encoding' => 'utf8'));
             break;
     }
     return $request;
 }
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:34,代码来源:content.php


示例6: __call

 public function __call($method, $params)
 {
     if (!function_exists('xmlrpc_encode_request')) {
         throw new \Exception("The php5-xmlrpc extension is not installed. Please install this to use this functionality");
     }
     $xml = xmlrpc_encode_request($method, $params);
     //\GO::debug($xml);
     if ($this->curl_hdl === null) {
         // Create cURL resource
         $this->curl_hdl = curl_init();
         // Configure options
         curl_setopt($this->curl_hdl, CURLOPT_URL, $this->uri);
         curl_setopt($this->curl_hdl, CURLOPT_HEADER, 0);
         curl_setopt($this->curl_hdl, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($this->curl_hdl, CURLOPT_POST, true);
         curl_setopt($this->curl_hdl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($this->curl_hdl, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($this->curl_hdl, CURLOPT_TIMEOUT, 10);
         if (isset($this->_user)) {
             curl_setopt($this->curl_hdl, CURLOPT_USERPWD, $this->_user . ":" . $this->_pass);
         }
     }
     curl_setopt($this->curl_hdl, CURLOPT_POSTFIELDS, $xml);
     // Invoke RPC command
     $response = curl_exec($this->curl_hdl);
     $errorNo = curl_errno($this->curl_hdl);
     if ($errorNo) {
         throw new \Exception($this->_curlErrorCodes[$errorNo]);
     }
     //\GO::debug($response);
     $result = xmlrpc_decode_request($response, $method);
     return $result;
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:33,代码来源:XMLRPCClient.php


示例7: serialize

 /** {@inheritdoc} */
 public function serialize($method, array $params = [])
 {
     $toBeVisited = [&$params];
     while (isset($toBeVisited[0]) && ($value =& $toBeVisited[0])) {
         $type = gettype($value);
         if ($type === 'array') {
             foreach ($value as &$child) {
                 $toBeVisited[] =& $child;
             }
         } elseif ($type === 'object') {
             if ($value instanceof DateTime) {
                 $value = $value->format('Ymd\\TH:i:s');
                 xmlrpc_set_type($value, 'datetime');
             } elseif ($value instanceof Base64Interface) {
                 $value = $value->getDecoded();
                 xmlrpc_set_type($value, 'base64');
             } else {
                 $value = get_object_vars($value);
             }
         } elseif ($type === 'resource') {
             throw SerializationException::invalidType($value);
         }
         array_shift($toBeVisited);
     }
     return xmlrpc_encode_request($method, $params, ['encoding' => 'UTF-8', 'escaping' => 'markup', 'verbosity' => 'no_white_space']);
 }
开发者ID:Banjerr,项目名称:infusionWholesaler,代码行数:27,代码来源:NativeSerializer.php


示例8: onStartNoticeSave

 function onStartNoticeSave($notice)
 {
     $args = $this->testArgs($notice);
     common_debug("Blogspamnet args = " . print_r($args, TRUE));
     $request = xmlrpc_encode_request('testComment', array($args));
     $context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml\r\n" . "User-Agent: " . $this->userAgent(), 'content' => $request)));
     $file = file_get_contents($this->baseUrl, false, $context);
     $response = xmlrpc_decode($file);
     if (xmlrpc_is_fault($response)) {
         throw new ServerException("{$response['faultString']} ({$response['faultCode']})", 500);
     } else {
         common_debug("Blogspamnet results = " . $response);
         if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
             throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500);
         } else {
             if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
                 throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400);
             } else {
                 if (preg_match('/^OK$/', $response)) {
                     // don't do anything
                 } else {
                     throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500);
                 }
             }
         }
     }
     return true;
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:28,代码来源:BlogspamNetPlugin.php


示例9: xmlrpc_request

function xmlrpc_request($host, $port, $location, $function, &$request_data)
{
    /*
     * This method sends a very basic XML-RPC request. $host, $port, $location,
     * and $function are pretty simple. $request_data can be any PHP type,
     * and this function returns the PHP type of whatever the xmlrpc function
     * returns.
     *
     * WARNING: This function dies upon failure.
     */
    // Send request
    $request_xml = xmlrpc_encode_request($function, $request_data);
    // Split out response into headers, and xml
    $response = urlpost($host, $port, $location, $request_xml);
    $response_array = split("\r\n\r\n", $response, 2);
    $response_headers = split("\r\n", $response_array[0]);
    $response_xml = $response_array[1];
    $http_array = split(" ", $response_headers[0], 3);
    if ($http_array[1] != "200") {
        trigger_error("xmlrpc request failed: ({$http_array[1]}, {$http_array[2]}) at {$host}:{$port} using {$location}");
    } else {
        // Get native PHP types and return them for data.
        $response_data = xmlrpc_decode_request($response_xml, $function);
        return $response_data;
    }
}
开发者ID:BGCX261,项目名称:zoto-server-svn-to-git,代码行数:26,代码来源:upload.php


示例10: sendRequest

 /**
  * @method sendRequest
  * @param string $remoteMethod
  * @param array $params
  * @return HttpRequest_Response_Xml 
  */
 public function sendRequest($remoteMethod, array $params)
 {
     $this->error = NULL;
     $request = xmlrpc_encode_request($remoteMethod, $params);
     $this->body = $request;
     return $this->request('CUSTOMPOST', $request);
 }
开发者ID:vgsystems,项目名称:seobingos,代码行数:13,代码来源:XmlRpc.php


示例11: _call

 /**
  * Provede volani funkce na captcha server
  *
  * @param string $methodName nazev metody
  * @param array $params parametry
  *
  * @return mixed    vysledek volani
  */
 protected function _call($methodName, $params = [])
 {
     if (!function_exists('xmlrpc_encode_request')) {
         throw new Exception("PHP XMLRPC extension neni nainstalovana");
     }
     $ch = curl_init(sprintf('http://%s:%d', $this->_serverHostname, $this->_serverPort));
     if (!$ch) {
         throw new Exception("Chyba volani curl_init");
     }
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($ch, CURLOPT_POST, TRUE);
     if ($this->_proxyHostname) {
         curl_setopt($ch, CURLOPT_PROXY, $this->_proxyHostname);
         curl_setopt($ch, CURLOPT_PROXYPORT, $this->_proxyPort);
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: text/xml", "charset=UTF-8"]);
     $request = xmlrpc_encode_request($methodName, $params, ['encoding' => 'UTF-8']);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
     $response = curl_exec($ch);
     if ($response === FALSE) {
         throw new Exception("Chyba volani curl_exec");
     }
     $info = curl_getinfo($ch);
     if ($info['http_code'] != 200) {
         throw new Exception("Chyba volani curl_exec. HTTP status code " . $info['http_code']);
     }
     $response = xmlrpc_decode($response, 'UTF-8');
     if (empty($response) || xmlrpc_is_fault($response)) {
         throw new Exception(sprintf("XMLRPC error: %s", print_r($response, TRUE)));
     }
     return $response;
 }
开发者ID:f3l1x,项目名称:nette-plugins,代码行数:40,代码来源:captcha_xmlrpc.class.php


示例12: onStartNoticeSave

 function onStartNoticeSave($notice)
 {
     $args = $this->testArgs($notice);
     common_debug("Blogspamnet args = " . print_r($args, TRUE));
     $requestBody = xmlrpc_encode_request('testComment', array($args));
     $request = new HTTPClient($this->baseUrl, HTTPClient::METHOD_POST);
     $request->setHeader('Content-Type', 'text/xml');
     $request->setBody($requestBody);
     $httpResponse = $request->send();
     $response = xmlrpc_decode($httpResponse->getBody());
     if (xmlrpc_is_fault($response)) {
         throw new ServerException("{$response['faultString']} ({$response['faultCode']})", 500);
     } else {
         common_debug("Blogspamnet results = " . $response);
         if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
             throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500);
         } else {
             if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
                 throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400);
             } else {
                 if (preg_match('/^OK$/', $response)) {
                     // don't do anything
                 } else {
                     throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500);
                 }
             }
         }
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:30,代码来源:BlogspamNetPlugin.php


示例13: ping

 /**
  * Ping Blog Update Services
  *
  * @param array $options are name, website, url
  */
 function ping($options = array())
 {
     $type = 'REST';
     if (function_exists('xmlrpc_encode_request')) {
         $type = 'XML-RPC';
     }
     switch ($type) {
         case 'REST':
             // construct parameters
             $params = array('name' => $options['name'], 'url' => $options['url']);
             $params = array_map('rawurlencode', $params);
             $paramString = http_build_query($params);
             // Rest Update Ping Services
             foreach ($this->__services['rest'] as $serviceApi) {
                 $requestUrl = $serviceApi . '?' . $paramString;
                 $response = file_get_contents($requestUrl);
             }
             break;
         case 'XML-RPC':
             // construct parameters
             $params = array($options['name'], $options['website'], $options['url'], $options['feed']);
             $request = xmlrpc_encode_request("weblogUpdates.extendedPing", $params);
             $context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request)));
             foreach ($this->__services['rpc'] as $endPoint) {
                 // Ping the services
                 $file = file_get_contents($endPoint, false, $context);
                 $response = xmlrpc_decode($file);
                 //no need to process the response
             }
             break;
     }
 }
开发者ID:rayhan,项目名称:ping_service,代码行数:37,代码来源:ping_service.php


示例14: rpc_call

 /**
  * rpc_call function.
  * 
  * @access public
  * @param string $method. (default: '')
  * @param array $params. (default: array())
  * @return void
  */
 function rpc_call($method = '', $params = array())
 {
     $request = new WP_Http();
     if (function_exists('xmlrpc_encode_request')) {
         $params = xmlrpc_encode_request($method, $params);
     }
     return $request->request($this->getServiceUrl(), array('method' => 'POST', 'body' => $params));
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:16,代码来源:WPSDSoaHelper.php


示例15: send

 /**
  * Sends an XML RPC request to the XML RPC server
  * @param $methodName string Name of the XML RPC method to call
  * @param $params array Array of parameters to pass to the XML RPC method. Type is detected automatically. For a struct just encode an array within $params.
  * @return array Array of returned parameters
  */
 public function send($methodName, $params)
 {
     $request = xmlrpc_encode_request($methodName, $params);
     $response = $this->sendRequest($request);
     $response = xmlrpc_decode(trim($response));
     //Without the trim function returns null
     return $response;
 }
开发者ID:bangnaga,项目名称:HomeOverlord,代码行数:14,代码来源:Client.php


示例16: __call

 /**
  * Call server RPC method
  * 
  * @param string method name
  * @param array arguments
  * @return string
  */
 function __call($function, $argv)
 {
     $request = xmlrpc_encode_request($function, $argv);
     $headers = array('Content-Type: text/xml', 'Content-Length: ' . strlen($request) . "\r\n\r\n" . $request);
     $this->SetHeaders($headers);
     $this->Fetch($this->Host, array(), true);
     return xmlrpc_decode($this->Result);
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:15,代码来源:class.RPCClient.php


示例17: request

 public function request($function, array $parameters = null)
 {
     $request = \xmlrpc_encode_request($function, $parameters);
     $context = \stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request)));
     $file = \file_get_contents($this->imgSeekUrl . '/RPC', false, $context);
     $response = \xmlrpc_decode($file);
     return $response;
 }
开发者ID:iampersistent,项目名称:imgseek-php,代码行数:8,代码来源:ImgSeekXMLRPCClient.php


示例18: __construct

 /**
  * @param string URL
  * @param string method to call
  * @param string method's arguments
  */
 function __construct($url, $method, $params)
 {
     if (!function_exists('xmlrpc_encode_request')) {
         return Error::raise(_t('xmlrpc extension not found'));
     }
     $this->url = $url;
     $this->method = $method;
     $this->params = $params;
     $this->request_body = xmlrpc_encode_request($method, $params);
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:15,代码来源:rpcclient.php


示例19: fnXmlRpcEncodeRequest

 /**
  * Replacement for "xmlrpc_encode_request"
  * @param $psString
  * @param array $parrArray
  * @return string
  * @author Progi1984
  */
 private function fnXmlRpcEncodeRequest($psString, array $parrArray)
 {
     if ($this->extPHPXMLRPC == true) {
         return xmlrpc_encode_request($psString, $parrArray);
     } else {
         $psReturn = '<?xml version="1.0" encoding="iso-8859-1"?>';
         $psReturn .= '<methodCall><methodName>' . $psString . '</methodName><params/></methodCall>';
         return $psReturn;
     }
 }
开发者ID:progi1984,项目名称:phpglances,代码行数:17,代码来源:PHPGlances.php


示例20: call

 public function call($method, $params = null)
 {
     $postData = xmlrpc_encode_request($method, $params);
     $httpHeader = array('Content-Type: text/xml;charset=UTF-8');
     $curlResult = CURL::post($this->url, $postData, $httpHeader);
     if ($curlResult === 'Error') {
         return [];
     }
     return xmlrpc_decode($curlResult);
 }
开发者ID:CollinDai,项目名称:ts-server,代码行数:10,代码来源:XMLRPC_Client.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xmlrpc_getpostcategory函数代码示例发布时间:2022-05-23
下一篇:
PHP xmlrpc_encode_entitites函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap