本文整理汇总了PHP中XML_RPC_Client::setDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Client::setDebug方法的具体用法?PHP XML_RPC_Client::setDebug怎么用?PHP XML_RPC_Client::setDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_RPC_Client
的用法示例。
在下文中一共展示了XML_RPC_Client::setDebug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
}
示例2: 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());
}
}
示例3: 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;
require_once 'XML/RPC.php';
$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->errstr . '; 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;
}
示例4: get_firmware_version
function get_firmware_version($return_php = true)
{
global $g;
$versioncheck_base_url = "packages.pfsense.org";
$versioncheck_path = "/xmlrpc.php";
if (isset($config['system']['alt_firmware_url']['enabled']) and isset($config['system']['alt_firmware_url']['versioncheck_base_url'])) {
$versioncheck_base_url = $config['system']['alt_firmware_url']['versioncheck_base_url'];
}
$params = array("platform" => "pfSense", "firmware" => array("version" => "0.62.5", "branch" => "stable"), "kernel" => array("version" => "5.4"), "base" => array("version" => "5.4"));
print_r($params);
$msg = new XML_RPC_Message('pfsense.get_firmware_version', array(php_value_to_xmlrpc($params)));
print "Formed message.\n";
$cli = new XML_RPC_Client($versioncheck_path, $versioncheck_base_url);
print "Formed client.\n";
$cli->setDebug(1);
$resp = $cli->send($msg);
print "Message sent.\n";
$raw_versions = $resp->value();
return xmlrpc_value_to_php($raw_versions);
}
示例5: grabWikiPage
public function grabWikiPage($pagename, $wikiname, $url = '/index.php?module=api', $serv = 'fsiu.uwc.ac.za')
{
$msg = new XML_RPC_Message('chiswiki.getPage', array(new XML_RPC_Value($pagename, "string"), new XML_RPC_Value($wikiname, "string")));
$cli = new XML_RPC_Client($url, $serv);
$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();
return $val->serialize($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());
}
}
示例6: array
if (isset($_REQUEST['addarticle'])) {
if (!in_array($_REQUEST['articleId'], $sendarticles)) {
$sendarticles[] = $_REQUEST['articleId'];
}
}
if (isset($_REQUEST['cleararticles'])) {
$sendarticles = array();
}
$structures = $structlib->list_structures(0, -1, 'pageName_asc', $find);
$smarty->assign_by_ref('structures', $structures['data']);
$msg = '';
if (isset($_REQUEST['send'])) {
check_ticket('send-objects');
// Create XMLRPC object
$client = new XML_RPC_Client($_REQUEST['path'], $_REQUEST['site'], 80);
$client->setDebug(isset($_REQUEST['dbg']) && $_REQUEST['dbg'] == 'on' ? true : false);
foreach ($sendstructures as $structure) {
$spages = $structlib->s_get_structure_pages($structure);
$pos = 0;
foreach ($spages as $spage) {
$listPageNames[$spage['page_ref_id']] = $spage['pageName'];
$page_info = $tikilib->get_page_info($spage['pageName']);
$pos++;
$searchMsg = new XML_RPC_Message('sendStructurePage', array(new XML_RPC_Value($_SERVER['SERVER_NAME'], 'string'), new XML_RPC_Value($_REQUEST['username'], 'string'), new XML_RPC_Value($_REQUEST['password'], 'string'), new XML_RPC_Value($spages[0]['pageName'], 'string'), new XML_RPC_Value($spage['parent_id'] ? $listPageNames[$spage['parent_id']] : $spage['pageName'], 'string'), new XML_RPC_Value($spage['pageName'], 'string'), new XML_RPC_Value(base64_encode($page_info['data']), 'string'), new XML_RPC_Value($page_info['comment'], 'string'), new XML_RPC_Value($page_info['description'], 'string'), new XML_RPC_Value($pos, 'string'), new XML_RPC_Value($spage['page_alias'], 'string')));
$result = $client->send($searchMsg);
if (!$result) {
$errorMsg = tra('Cannot login to server maybe the server is down');
$msg .= $errorMsg;
} else {
if (!$result->faultCode()) {
$msg .= tra('Page') . ': ' . $spage['pageName'] . ' ' . tra('successfully sent') . '<br />';
示例7: send
/**
* Send a pingback.
*
* @param array $data (optional) An array of pingback data.
*
* @access public
* @see autodiscover()
*/
function send($data = null)
{
if ($data !== null) {
$res = $this->setFromArray($data);
if (PEAR::isError($res)) {
return $res;
}
}
// Find the whether if source and target is equal or not.
if (strstr($this->_data['sourceURI'], $this->_data['targetURI'])) {
return PEAR::raiseError('Target URI is equal with source URI');
}
// pingback URI set
if (empty($this->_data['pingbackURI'])) {
$res = Services_Pingback::autodiscover($this->_data['targetURI']);
if (PEAR::isError($res)) {
return $res;
} else {
if (empty($res)) {
return PEAR::raiseError('Target URI is not a pingback-enabled resource');
}
}
$this->_data['pingbackURI'] = $res;
}
// Prepare an XML-RPC Message.
$eArgs = array(XML_RPC_encode($this->_data['sourceURI']), XML_RPC_encode($this->_data['targetURI']));
$msg = new XML_RPC_Message('pingback.ping', $eArgs);
// Prepare full path of URI to conforms XML_RPC_Client parameter.
$url = new Net_URL($this->_data['pingbackURI']);
$path = $url->path;
$querystring = $url->getQueryString();
if (!empty($querystring)) {
$path .= '?' . $querystring;
}
$cli = new XML_RPC_Client($path, $url->protocol . '://' . $url->host, $url->port);
$cli->setDebug((int) $this->_options['debug']);
// save the current error handling in buffer for restore.
$default_error_mode = $GLOBALS['_PEAR_default_error_mode'];
$default_error_options = $GLOBALS['_PEAR_default_error_options'];
// Set error mode to callback, since XML_RPC doesn't return error object on failure.
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'XML_RPC_ErrorCallback'));
$res = $cli->send($msg, (int) $this->_options['timeout']);
// Cacth the error if any.
if ($this->_isXML_RPC_Error()) {
return $this->_XML_RPC_Error;
}
$val = $res->value();
if (!is_object($val) || !is_a($val, 'XML_RPC_value')) {
return PEAR::raiseError('Response Error: ' . $res->faultString());
}
// restore the current error handling.
PEAR::setErrorHandling($default_error_mode, $default_error_options);
return XML_RPC_decode($val);
}
示例8: validatePDF_2
function validatePDF_2($magic, $callback_URL, $fileID, $file)
{
global $hotdir, $max_processing_seconds, $INP, $NPDF_ERR, $NPDF, $ORIG_ERR, $ORIG_OK, $PROC_ERR, $PROC_OK, $REP_ERR, $REP_OK, $INP_absolute, $xmlrpc, $DEBUG;
ignore_user_abort();
// function may take a long time
set_time_limit($max_processing_seconds + 10);
// does not work in safe mode
ini_set("max_execution_time", $max_processing_seconds + 10);
// does not work in safe mode
if ($DEBUG) {
informAdmin("DEBUG: called validatePDF_2( {$magic}, {$callback_URL}, {$fileID}, {$file} )");
}
// security issue
$file = basename($file);
// to avoid s.th. like '../../../etc/passwd'
// wait for pitstop to process the file
$file_log = "{$file}_log.pdf";
// PitStop names reports like this
$start_time = time();
while (file_exists(cleanPath("{$hotdir}/{$INP}/{$file}")) && $start_time + $max_processing_seconds > time()) {
clearstatcache();
sleep(5);
}
// MISCONCEPTION - PitStop removes the input file before all other files have been written to disk. Especially the Report takes longer.
// wait for report to appear
$report_present = false;
while (!$report_present && $start_time + $max_processing_seconds > time()) {
clearstatcache();
$report_present = file_exists(cleanPath("{$hotdir}/{$REP_ERR}/{$file_log}")) || file_exists(cleanPath("{$hotdir}/{$REP_OK}/{$file_log}")) || file_exists(cleanPath("{$hotdir}/{$NPDF_ERR}/{$file_log}"));
sleep(5);
}
if ($start_time + $max_processing_seconds <= time()) {
// cleanup - not all files will be present, thus neglect warnings
cleanup($file);
informAdmin("validation tooks too long. PitStop server not running? HotDir is '{$hotdir}' and input folder is named '{$INP}'");
return false;
// validation tooks too long
}
sleep(5);
// let PitStop write all files
clearstatcache();
$valid = 2;
// validation was aborted
// PitStop has removed the file, now check the result
if (file_exists(cleanPath("{$hotdir}/{$NPDF}/{$file}"))) {
$reportFileName = cleanPath("{$hotdir}/{$NPDF_ERR}/{$file_log}");
$valid = false;
}
if (file_exists(cleanPath("{$hotdir}/{$ORIG_ERR}/{$file}"))) {
$reportFileName = cleanPath("{$hotdir}/{$REP_ERR}/{$file_log}");
$valid = false;
}
if (file_exists(cleanPath("{$hotdir}/{$ORIG_OK}/{$file}"))) {
$reportFileName = cleanPath("{$hotdir}/{$REP_OK}/{$file_log}");
$valid = true;
}
if ($valid === 2) {
// cleanup - not all files will be present, thus neglect warnings
cleanup($file);
informAdmin("validation was aborted. Input file was removed, but result is not present.");
return false;
}
if ($DEBUG) {
if ($valid) {
$temp = "pdf file is valid";
} else {
$temp = "file is not valid";
}
informAdmin("DEBUG: validation process completed.\n{$temp}");
}
// PitStop may produce reports with 350 pages and more. These reports can be as large as 8 MiB.
// If pdftk (http://www.pdftk.com) is available, truncate the report; otherwise do not send, if too large
$data = truncate_pdf($reportFileName);
// call the callback function to announce results of validation
$server = parse_url($callback_URL);
$server['port'] = $server['port'] ? $server['port'] : 80;
if ($xmlrpc['pear']) {
// use XML_RPC impl. to contact the callback function, which in turn will commit the result to the database
$client = new XML_RPC_Client($server['path'], $server['host'], $server['port']);
$params = array(new XML_RPC_Value($data, 'base64'), new XML_RPC_Value($valid, 'boolean'), new XML_RPC_Value($magic, 'int'), new XML_RPC_Value($fileID, 'int'));
$xmlrpc_message = new XML_RPC_Message('validatePDF_callback', $params);
if ($DEBUG) {
$client->setDebug(1);
ob_start();
}
$client->send($xmlrpc_message);
if ($DEBUG) {
informAdmin("server reports:\n" . ob_get_contents());
ob_end_clean();
}
} elseif ($xmlrpc['internal']) {
// use internal impl. to contact the callback function, which in turn will commit the result to the database
xmlrpc_set_type($data, "base64");
// converts the string to an object with encoding 'base64'
$params = array($data, $valid, $magic, $fileID);
$output = array('output_type' => 'php');
xu_rpc_http_concise(array(method => 'validatePDF_callback', args => $params, host => $server['host'], uri => $server['path'], port => $server['port'], debug => 0, output => $output));
}
if ($DEBUG) {
informAdmin("DEBUG: callback function validatePDF_callback() at {$callback_URL} was called.");
//.........这里部分代码省略.........
示例9: intervalidate
function intervalidate($remote, $user, $pass, $get_info = false)
{
global $tiki_key;
$remote['path'] = preg_replace("/^\\/?/", "/", $remote['path']);
$client = new XML_RPC_Client($remote['path'], $remote['host'], $remote['port']);
$client->setDebug(0);
$msg = new XML_RPC_Message('intertiki.validate', array(new XML_RPC_Value($tiki_key, 'string'), new XML_RPC_Value($user, 'string'), new XML_RPC_Value($pass, 'string'), new XML_RPC_Value($get_info, 'boolean')));
$result = $client->send($msg);
return $result;
}
示例10: getCoreZip
public function getCoreZip($modName)
{
$msg = new XML_RPC_Message('getEngineUpgrade');
$cli = new XML_RPC_Client($this->mirrorurl, $this->mirrorserv, $this->port, $this->proxy['proxy_host'], $this->proxy['proxy_port'], $this->proxy['proxy_user'], $this->proxy['proxy_pass']);
$cli->setDebug(0);
// send the request message
$resp = $cli->send($msg);
//log_debug($resp);
if (!$resp) {
throw new customException($this->objLanguage->languageText("mod_packages_commserr", "packages") . ": " . $cli->errstr);
exit;
}
if (!$resp->faultCode()) {
$val = $resp->value();
return $val->serialize($val);
} else {
/*
* Display problems that have been gracefully caught and
* reported by the xmlrpc server class.
*/
throw new customException($this->objLanguage->languageText("mod_packages_faultcode", "packages") . ": " . $resp->faultCode() . $this->objLanguage->languageText("mod_packages_faultreason", "packages") . ": " . $resp->faultString());
}
}
示例11: unserialize
function get_remote_user_by_cookie($hash)
{
global $prefs;
include_once('XML/RPC.php');
$prefs['interlist'] = unserialize($prefs['interlist']);
$remote = $prefs['interlist'][$prefs['feature_intertiki_mymaster']];
$client = new XML_RPC_Client($remote['path'], $remote['host'], $remote['port']);
$client->setDebug(0);
$msg = new XML_RPC_Message(
'intertiki.cookiecheck',
array(
new XML_RPC_Value($prefs['tiki_key'], 'string'),
new XML_RPC_Value($hash, 'string')
)
);
$result = $client->send($msg);
return $result;
}
示例12: perform
/**
* get article data through rpc
*
* @param array $data
*/
function perform($data = FALSE)
{
// set default num articles to fetch
if (!isset($data['numArticles'])) {
$data['numArticles'] = 8;
}
// set default port
if (!isset($data['port'])) {
$data['port'] = 80;
}
// set default user
if (!isset($data['query'])) {
$data['query'] = '';
}
// set default methode
if (!isset($data['methode'])) {
$data['methode'] = 'latestPublished';
}
// set default user
if (!isset($data['authUser'])) {
$data['authUser'] = '';
}
// set default user
if (!isset($data['authPasswd'])) {
$data['authPasswd'] = '';
}
// methode map of article fields
$methodeField = array('latestModified' => 'modifydate', 'latestPublished' => 'pubdate');
// start rpc client
$client = new XML_RPC_Client($data['rpcServer'] . $data['query'], $data['domain'], $data['port']);
if (isset($data['debug'])) {
$client->setDebug(1);
}
// set rpc methode and parameters
$msg = new XML_RPC_Message($data['methode'], array(new XML_RPC_Value($data['authUser'], "string"), new XML_RPC_Value($data['authPasswd'], "string"), new XML_RPC_Value($data['numArticles'], "int")));
$response = $client->send($msg);
if (!$response->faultCode()) {
$data['error'] = false;
$content = $response->value();
$max = $content->arraysize();
for ($i = 0; $i < $max; $i++) {
// get element of the array
$rec = $content->arraymem($i);
// get the associative array value
$article_date = $rec->structmem($methodeField[$data['methode']]);
$data['result'][$i]['date'] = $article_date->scalarval();
$overtitle = $rec->structmem('overtitle');
$data['result'][$i]['overtitle'] = $overtitle->scalarval();
$id_article = $rec->structmem('id_article');
$data['result'][$i]['id_article'] = $id_article->scalarval();
$title = $rec->structmem('title');
$data['result'][$i]['title'] = $title->scalarval();
$subtitle = $rec->structmem('subtitle');
$data['result'][$i]['subtitle'] = $subtitle->scalarval();
$description = $rec->structmem('description');
$data['result'][$i]['description'] = $description->scalarval();
}
} else {
$data['error'] = true;
trigger_error('RPC call fault. \\nCode: ' . $response->faultCode() . '\\nReason: ' . $response->faultString(), E_USER_WARNING);
}
}
示例13: array
* installed version of XML_RPC which should be in the include path.
*
* If the version has not been substituted in the if() expression,
* this file has likely come from a SVN checkout or a .tar file.
* Therefore, we'll assume the tests should use the version of
* XML_RPC that has come from there as well.
*/
if ('1.5.4' == '@' . 'package_version' . '@') {
ini_set('include_path', '../' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . ini_get('include_path'));
}
require_once 'XML/RPC/Dump.php';
$debug = 0;
$params = array(new XML_RPC_Value('php.net', 'string'));
$msg = new XML_RPC_Message('domquery', $params);
$client = new XML_RPC_Client('/api/xmlrpc', 'www.adamsnames.com');
$client->setDebug($debug);
$resp = $client->send($msg);
if (!$resp) {
echo 'Communication error: ' . $client->errstr;
exit(1);
}
if ($resp->faultCode()) {
/*
* Display problems that have been gracefully cought and
* reported by the xmlrpc.php script
*/
echo 'Fault Code: ' . $resp->faultCode() . "\n";
echo 'Fault Reason: ' . $resp->faultString() . "\n";
exit(1);
}
$val = $resp->value();
示例14: unserialize
function get_remote_user_by_cookie($hash)
{
global $prefs;
include_once 'XML/RPC.php';
$prefs['interlist'] = unserialize($prefs['interlist']);
$remote = $prefs['interlist'][$prefs['feature_intertiki_mymaster']];
// $fp=fopen('temp/interlogtest','a+');fputs($fp,"slave -- ".$hash." --\n");fclose($fp);
$client = new XML_RPC_Client($remote['path'], $remote['host'], $remote['port']);
$client->setDebug(0);
$msg = new XML_RPC_Message('intertiki.cookiecheck', array(new XML_RPC_Value($prefs['tiki_key'], 'string'), new XML_RPC_Value($hash, 'string')));
$result = $client->send($msg);
return $result;
}
示例15: call
function call($method)
{
$_args = $args = func_get_args();
$this->cache = $this->getCache($args);
$cachettl = $this->config->get('cache_ttl');
// If cache is newer than $cachettl seconds, we use the cache!
if ($this->cache !== null && $this->cache['age'] < $cachettl) {
return $this->cache['content'];
}
if (extension_loaded("xmlrpc")) {
$result = call_user_func_array(array(&$this, 'call_epi'), $args);
if (!PEAR::isError($result)) {
$this->saveCache($_args, $result);
}
return $result;
}
if (!@(include_once "XML/RPC.php")) {
return $this->raiseError("For this remote PEAR operation you need to install the XML_RPC package");
}
array_shift($args);
$server_host = $this->config->get('master_server');
$username = $this->config->get('username');
$password = $this->config->get('password');
$eargs = array();
foreach ($args as $arg) {
$eargs[] = $this->_encode($arg);
}
$f = new XML_RPC_Message($method, $eargs);
if ($this->cache !== null) {
$maxAge = '?maxAge=' . $this->cache['lastChange'];
} else {
$maxAge = '';
}
$proxy_host = $proxy_port = $proxy_user = $proxy_pass = '';
if ($proxy = parse_url($this->config->get('http_proxy'))) {
$proxy_host = @$proxy['host'];
$proxy_port = @$proxy['port'];
$proxy_user = @urldecode(@$proxy['user']);
$proxy_pass = @urldecode(@$proxy['pass']);
}
$c = new XML_RPC_Client('/xmlrpc.php' . $maxAge, $server_host, 80, $proxy_host, $proxy_port, $proxy_user, $proxy_pass);
if ($username && $password) {
$c->setCredentials($username, $password);
}
if ($this->config->get('verbose') >= 3) {
$c->setDebug(1);
}
$r = $c->send($f);
if (!$r) {
return $this->raiseError("XML_RPC send failed");
}
$v = $r->value();
if ($e = $r->faultCode()) {
if ($e == $GLOBALS['XML_RPC_err']['http_error'] && strstr($r->faultString(), '304 Not Modified') !== false) {
return $this->cache['content'];
}
return $this->raiseError($r->faultString(), $e);
}
$result = XML_RPC_decode($v);
$this->saveCache($_args, $result);
return $result;
}