本文整理汇总了PHP中XML_RPC_Client::getErrorString方法的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Client::getErrorString方法的具体用法?PHP XML_RPC_Client::getErrorString怎么用?PHP XML_RPC_Client::getErrorString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_RPC_Client
的用法示例。
在下文中一共展示了XML_RPC_Client::getErrorString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckForSpam
/**
* Check for spam links
*
* @param string $post post to check for spam
* @return boolean true = spam found, false = no spam
* Note: Also returns 'false' in case of problems communicating with SLV.
* Error messages are logged in Geeklog's error.log
*/
public function CheckForSpam($post)
{
global $_SPX_CONF;
$retval = false;
if (empty($post)) {
return $retval;
}
$links = $this->prepareLinks($post);
if (empty($links)) {
return $retval;
}
if (!isset($_SPX_CONF['timeout'])) {
$_SPX_CONF['timeout'] = 5;
// seconds
}
if ($this->_verbose) {
SPAMX_log("Sending to SLV: {$links}");
}
$params = array(new XML_RPC_Value($links, 'string'));
$msg = new XML_RPC_Message('slv', $params);
$cli = new XML_RPC_Client('/slv.php', 'http://www.linksleeve.org');
if ($this->_debug) {
$cli->setDebug(1);
}
$resp = $cli->send($msg, $_SPX_CONF['timeout']);
if (!$resp) {
COM_errorLog('Error communicating with SLV: ' . $cli->getErrorString() . '; Message was ' . $msg->serialize());
} else {
if ($resp->faultCode()) {
COM_errorLog('Error communicating with SLV. Fault code: ' . $resp->faultCode() . ', Fault reason: ' . $resp->faultString() . '; Message was ' . $msg->serialize());
} else {
$val = $resp->value();
// note that SLV returns '1' for acceptable posts and '0' for spam
if ($val->scalarval() != '1') {
$retval = true;
SPAMX_log("SLV: spam detected");
} else {
if ($this->_verbose) {
SPAMX_log("SLV: no spam detected");
}
}
}
}
return $retval;
}
示例2: PNB_sendPingback
/**
* Send a Pingback
*
* @param string $sourceURI URL of an entry on our site
* @param string $targetURI an entry on someone else's site
* @return string empty string on success or error message
*/
function PNB_sendPingback($sourceURI, $targetURI)
{
global $LANG_TRB;
$retval = '';
$pingback = PNB_getPingbackUrl($targetURI);
if (empty($pingback)) {
return $LANG_TRB['no_pingback_url'];
}
$parts = parse_url($pingback);
if (empty($parts['port'])) {
if (strcasecmp($parts['scheme'], 'https') == 0) {
$parts['port'] = 443;
} else {
$parts['port'] = 80;
}
}
if (!empty($parts['query'])) {
$parts['path'] .= '?' . $parts['query'];
}
$client = new XML_RPC_Client($parts['path'], $parts['host'], $parts['port']);
//$client->setDebug (1);
$msg = new XML_RPC_Message('pingback.ping', array(new XML_RPC_Value($sourceURI, 'string'), new XML_RPC_Value($targetURI, 'string')));
$response = $client->send($msg, 0, $parts['scheme']);
if (!is_object($response) && $response == 0) {
$retval = $client->getErrorString();
} elseif ($response->faultCode() != 0) {
$retval = $response->faultString();
}
return $retval;
}