本文整理汇总了PHP中xmlrpc_is_fault函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_is_fault函数的具体用法?PHP xmlrpc_is_fault怎么用?PHP xmlrpc_is_fault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_is_fault函数的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: get_response
public static function get_response($server, $request, &$error = null, $fresh = false)
{
$ch = vpl_jailserver_manager::get_curl($server, $request, $fresh);
$raw_response = curl_exec($ch);
if ($raw_response === false) {
$error = 'request failed: ' . s(curl_error($ch));
curl_close($ch);
return false;
} else {
curl_close($ch);
$error = '';
$response = xmlrpc_decode($raw_response, "UTF-8");
if (is_array($response)) {
if (xmlrpc_is_fault($response)) {
$error = 'xmlrpc is fault: ' . s($response["faultString"]);
} else {
return $response;
}
} else {
$error = 'http error ' . s(strip_tags($raw_response));
$fail = true;
}
return false;
}
}
开发者ID:barak,项目名称:moodle-mod_vpl,代码行数:25,代码来源:jailserver_manager.class.php
示例3: 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
示例4: parse
/**
* {@inheritdoc}
*/
public function parse($xmlString, &$isFault)
{
$result = xmlrpc_decode($xmlString, 'UTF-8');
$isFault = false;
$toBeVisited = [&$result];
while (isset($toBeVisited[0]) && ($value =& $toBeVisited[0])) {
$type = gettype($value);
if ($type === 'object') {
$xmlRpcType = $value->{'xmlrpc_type'};
if ($xmlRpcType === 'datetime') {
$value = DateTime::createFromFormat('Ymd\\TH:i:s', $value->scalar, isset($timezone) ? $timezone : ($timezone = new DateTimeZone('UTC')));
} elseif ($xmlRpcType === 'base64') {
if ($value->scalar !== '') {
$value = Base64::serialize($value->scalar);
} else {
$value = null;
}
}
} elseif ($type === 'array') {
foreach ($value as &$element) {
$toBeVisited[] =& $element;
}
}
array_shift($toBeVisited);
}
if (is_array($result)) {
reset($result);
$isFault = xmlrpc_is_fault($result);
}
return $result;
}
开发者ID:Banjerr,项目名称:infusionPress_Forms,代码行数:34,代码来源:NativeParser.php
示例5: 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
示例6: isFault
/**
* This method checks whether the given argument is an XML-RPC fault.
*
* @param mixed $fault
*
* @return bool
*/
public static function isFault($fault)
{
if (isset($fault) && is_array($fault)) {
return xmlrpc_is_fault($fault);
} else {
return false;
}
}
开发者ID:darkaonline,项目名称:ripcord,代码行数:15,代码来源:Ripcord.php
示例7: get_xmlrpc_error
function get_xmlrpc_error($resp)
{
if (is_array($resp) && xmlrpc_is_fault($resp)) {
$message = 'Moodle Integrator - ' . $resp['faultCode'] . ' - ' . $resp['faultString'];
return ErrorMessage(array($message), 'error');
}
return null;
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:8,代码来源:client.php
示例8: ping_broadcast_notice
function ping_broadcast_notice($notice)
{
if ($notice->is_local != Notice::LOCAL_PUBLIC && $notice->is_local != Notice::LOCAL_NONPUBLIC) {
return true;
}
# Array of servers, URL => type
$notify = common_config('ping', 'notify');
$profile = $notice->getProfile();
$tags = ping_notice_tags($notice);
foreach ($notify as $notify_url => $type) {
switch ($type) {
case 'xmlrpc':
case 'extended':
$req = xmlrpc_encode_request('weblogUpdates.ping', array($profile->nickname, common_local_url('showstream', array('nickname' => $profile->nickname)), common_local_url('shownotice', array('notice' => $notice->id)), common_local_url('userrss', array('nickname' => $profile->nickname)), $tags));
$request = HTTPClient::start();
$request->setConfig('connect_timeout', common_config('ping', 'timeout'));
$request->setConfig('timeout', common_config('ping', 'timeout'));
try {
$httpResponse = $request->post($notify_url, array('Content-Type: text/xml'), $req);
} catch (Exception $e) {
common_log(LOG_ERR, "Exception pinging {$notify_url}: " . $e->getMessage());
continue;
}
if (!$httpResponse || mb_strlen($httpResponse->getBody()) == 0) {
common_log(LOG_WARNING, "XML-RPC empty results for ping ({$notify_url}, {$notice->id}) ");
continue;
}
$response = xmlrpc_decode($httpResponse->getBody());
if (is_array($response) && xmlrpc_is_fault($response)) {
common_log(LOG_WARNING, "XML-RPC error for ping ({$notify_url}, {$notice->id}) " . "{$response['faultString']} ({$response['faultCode']})");
} else {
common_log(LOG_INFO, "Ping success for {$notify_url} {$notice->id}");
}
break;
case 'get':
case 'post':
$args = array('name' => $profile->nickname, 'url' => common_local_url('showstream', array('nickname' => $profile->nickname)), 'changesURL' => common_local_url('userrss', array('nickname' => $profile->nickname)));
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
if ($type === 'get') {
$result = $fetcher->get($notify_url . '?' . http_build_query($args), array('User-Agent: StatusNet/' . STATUSNET_VERSION));
} else {
$result = $fetcher->post($notify_url, http_build_query($args), array('User-Agent: StatusNet/' . STATUSNET_VERSION));
}
if ($result->status != '200') {
common_log(LOG_WARNING, "Ping error for '{$notify_url}' ({$notice->id}): " . "{$result->body}");
} else {
common_log(LOG_INFO, "Ping success for '{$notify_url}' ({$notice->id}): " . "'{$result->body}'");
}
break;
default:
common_log(LOG_WARNING, 'Unknown notify type for ' . $notify_url . ': ' . $type);
}
}
return true;
}
开发者ID:Br3nda,项目名称:StatusNet,代码行数:55,代码来源:ping.php
示例9: call
/**
* Calls the method on the server with the given parameters
*
* @param string $method The method name
* @param array $parameters The argument parameters for the method
*
* @return string
*/
protected function call($method, array $parameters = array())
{
$request = xmlrpc_encode_request($method, $parameters);
$context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request)));
$contents = $this->fileRetriever->retrieveContents($this->getDSN(), $context);
$response = xmlrpc_decode($contents);
if ($response && is_array($response) && xmlrpc_is_fault($response)) {
trigger_error("xmlrpc: {$response['faultString']} ({$response['faultCode']})");
}
return $response;
}
开发者ID:createproblem,项目名称:bitmessage-php,代码行数:19,代码来源:XmlRpcClient.php
示例10: normalValidate
function normalValidate($command, $la, $code)
{
$request = xmlrpc_encode_request("validate", array($command, $la, AV_LOGIN, AV_PASSWD, $code));
$context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request)));
$file = file_get_contents(AV_RPC_URL, false, $context);
$response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) {
return false;
}
return $response['status'] == "OK";
}
开发者ID:Alambos,项目名称:fullserver,代码行数:11,代码来源:JustpaySMS.class.php
示例11: execute
public function execute($server)
{
$file = file_get_contents($server, false, $this->context);
if ($file == false) {
throw new Exception("Server didn't send an answer!");
}
$response = xmlrpc_decode($file);
if (is_array($response) && xmlrpc_is_fault($response)) {
throw new XMLRPCException($response['faultString'], $response['faultCode']);
}
return $response;
}
开发者ID:blackskad,项目名称:MollomMW,代码行数:12,代码来源:xmlrpc.php
示例12: commit_rpc
protected function commit_rpc()
{
$request = xmlrpc_encode_request($this->method, $this->parms);
$context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml; charset=utf-8\r\n" . "User-Agent: XMLRPC::Client JorgeRPCclient", 'content' => $request)));
$file = file_get_contents("http://{$this->rpc_server}" . ":" . "{$this->rpc_port}", false, $context);
$response = xmlrpc_decode($file, "utf8");
if (xmlrpc_is_fault($response)) {
throw new Exception("XML-RPC Call Failed. Unrecoverable condition", 0);
} else {
return $response;
}
}
开发者ID:Joywok,项目名称:ejabberd-contrib,代码行数:12,代码来源:class.ejabberd_xmlrpc.php
示例13: __call
public function __call($method, array $parameters = array())
{
$request = xmlrpc_encode_request(strlen($this->_namespace) > 0 ? "{$this->_namespace}.{$method}" : $method, $parameters);
$context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request)));
$file = file_get_contents($this->_url, false, $context);
$response = xmlrpc_decode($file);
if (is_null($response)) {
throw new XmlRpcClientException(array('faultString' => 'Invalid response from ' . $this->_url, 'faultCode' => 999));
}
if (@xmlrpc_is_fault($response)) {
throw new XmlRpcClientException($response);
}
return $response;
}
开发者ID:renanivo,项目名称:WP-Multisite-XML-RPC,代码行数:14,代码来源:xmlrpc-client.php
示例14: __call
public function __call($name, $arguments)
{
error_log("[FreesideSelfService] {$name} called, sending to " . $this->URL);
$request = xmlrpc_encode_request("FS.SelfService.XMLRPC.{$name}", $arguments);
$context = stream_context_create(array('http' => array('method' => "POST", 'header' => "Content-Type: text/xml", 'content' => $request)));
$file = file_get_contents($this->URL, false, $context);
$response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) {
trigger_error("[FreesideSelfService] XML-RPC communication error: {$response['faultString']} ({$response['faultCode']})");
} else {
//error_log("[FreesideSelfService] $response");
return $response;
}
}
开发者ID:carriercomm,项目名称:Freeside,代码行数:14,代码来源:freeside.class.php
示例15: make_request
function make_request($xml, &$output)
{
/* НАЧАЛО ЗАПРОСА */
$options = ['http' => ['method' => "POST", 'header' => "User-Agent: PHPRPC/1.0\r\n" . "Content-Type: text/xml\r\n" . "Content-length: " . strlen($xml) . "\r\n\n", 'content' => "{$xml}"]];
$context = stream_context_create($options);
$retval = file_get_contents('http://phpoopsite.local/xml-rpc/xml-rpc-server.php', false, $context);
/* КОНЕЦ ЗАПРОСА */
$data = xmlrpc_decode($retval);
if (is_array($data) && xmlrpc_is_fault($data)) {
$output = $data;
} else {
$output = unserialize(base64_decode($data));
}
}
开发者ID:sydorenkovd,项目名称:XML-RPC,代码行数:14,代码来源:xml-rpc-client.php
示例16: make_request
function make_request($request_xml, &$output)
{
$retval = call_socket('php.loc', 80, '/test/xml-rpc/xml-rpc-server.php', $request_xml);
/*НАЧАЛО ЗАПРОСА*/
/*$opts = array('http'=>array('method'=>"POST",'header'=>"User-Agent: PHPRPC/1.0\r\n"."Content-Type: text/xml\r\n"."Content-Length: ".strlen($request_xml)."\r\n",'content'=>"$request_xml"));
$context = stream_context_create($opts);
$retval = file_get_contents('http://php.loc/test/xml-rpc/xml-rpc-server.php');
/*КОНЕЦ ЗАПРОСА*/
$data = xmlrpc_decode($retval);
if (is_array($data) && xmlrpc_is_fault($data)) {
$output = $data;
} else {
$output = unserialize(base64_decode($data));
}
}
开发者ID:echmaster,项目名称:data,代码行数:15,代码来源:xml-rpc-client.php
示例17: requestSend
protected function requestSend($methodName, $args = array())
{
$output_options = array("output_type" => "xml", "verbosity" => "pretty", "escaping" => array("markup"), "version" => "xmlrpc", "encoding" => "utf-8");
$this->_post_fields = xmlrpc_encode_request($methodName, $args, $output_options);
// $headerSent = curl_getinfo($ch, CURLINFO_HEADER_OUT);
$output = $this->curl($this->_options['endpoint']);
$response = xmlrpc_decode($output, 'utf-8');
if (!is_array($response)) {
exit(print_r($this->_ch_info, true));
} elseif (xmlrpc_is_fault($response)) {
var_dump($response);
$response = false;
}
return $response;
}
开发者ID:roni5,项目名称:sevice_cms,代码行数:15,代码来源:Connector.php
示例18: _call
private function _call($request)
{
$context = stream_context_create(array('http' => array('method' => 'POST', 'header' => 'Content-Type: text/xml', 'content' => $request)));
if ($file = @file_get_contents($this->server, false, $context)) {
$file = str_replace('i8', 'double', $file);
$file = utf8_encode($file);
$ret = xmlrpc_decode($file);
if (is_array($ret) && xmlrpc_is_fault($ret)) {
throw new Exception('request failed:' . $ret['faultCode'] . ': ' . $ret['faultString']);
}
} else {
throw new Exception('request failed (' . $this->server . "):\n\n" . $request . "\n");
}
return $ret;
}
开发者ID:jka0,项目名称:php-rtorrent,代码行数:15,代码来源:xmlrpc.class.php
示例19: __call
function __call($method, $params = null, $debug = false)
{
global $billing_config;
$request = xmlrpc_encode_request('stargazer.' . $method, $params, array('escaping' => 'markup', 'encoding' => 'utf-8'));
$context = stream_context_create(array('http' => array('method' => 'POST', 'header' => 'Content-Type: text/xml', 'content' => $request)));
$file = file_get_contents('http://' . $billing_config['STG_HOST'] . ':' . $billing_config['XMLRPC_PORT'] . '/RPC2', false, $context);
$response = xmlrpc_decode($file);
if (is_array($response) && xmlrpc_is_fault($response)) {
trigger_error("xmlrpc: {$response['faultString']} ({$response['faultCode']})");
}
if ($debug) {
echo print_r($response);
}
return $response;
}
开发者ID:l1ght13aby,项目名称:Ubilling,代码行数:15,代码来源:handlers.php
示例20: searchSubtitles
/**
* Search for a list of subtitles in opensubtitles.org
*
* @param string $userToken
* @param string $movieToken
* @param int $fileSize
*
* @return array
*/
private function searchSubtitles($userToken, $movieToken, $fileSize)
{
$request = xmlrpc_encode_request("SearchSubtitles", array($userToken, array(array('sublanguageid' => $this->lang, 'moviehash' => $movieToken, 'moviebytesize' => $fileSize))));
$response = $this->generateResponse($request);
if ($response && xmlrpc_is_fault($response)) {
trigger_error("xmlrpc: {$response['faultString']} ({$response['faultCode']})");
} else {
if ($this->isWrongStatus($response)) {
trigger_error('no login');
} else {
return $response;
}
}
return array();
}
开发者ID:RubenHarms,项目名称:PhpOpenSubtitles,代码行数:24,代码来源:SubtitlesManager.php
注:本文中的xmlrpc_is_fault函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论