本文整理匯總了PHP中IXR_Client::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP IXR_Client::query方法的具體用法?PHP IXR_Client::query怎麽用?PHP IXR_Client::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IXR_Client
的用法示例。
在下文中一共展示了IXR_Client::query方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendpost
public function sendpost($id)
{
if ($this->host == '' || $this->login == '') {
return false;
}
$post = tpost::i($id);
ttheme::$vars['post'] = $post;
$theme = ttheme::i();
$content = $theme->parse($this->template);
$date = getdate($post->posted);
if ($post->status != 'published') {
return;
}
$meta = $post->meta;
$client = new IXR_Client($this->host, '/interface/xmlrpc');
//$client = new IXR_Client($this->host, '/rpc.xml');
if (!$client->query('LJ.XMLRPC.getchallenge')) {
if (litepublisher::$debug) {
tfiler::log('live journal: error challenge');
}
return false;
}
$response = $client->getResponse();
$challenge = $response['challenge'];
$args = array('username' => $this->login, 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . md5($this->password)), 'ver' => "1", 'event' => $content, 'subject' => $post->title, 'year' => $date['year'], 'mon' => $date['mon'], 'day' => $date['mday'], 'hour' => $date['hours'], 'min' => $date['minutes'], 'props' => array('opt_nocomments' => !$post->commentsenabled, 'opt_preformatted' => true, 'taglist' => $post->tagnames));
switch ($this->privacy) {
case "public":
$args['security'] = "public";
break;
case "private":
$args['security'] = "private";
break;
case "friends":
$args['security'] = "usemask";
$args['allowmask'] = 1;
}
if ($this->community != '') {
$args['usejournal'] = $this->community;
}
if (isset($meta->ljid)) {
$method = 'LJ.XMLRPC.editevent';
$args['itemid'] = $meta->ljid;
} else {
$method = 'LJ.XMLRPC.postevent';
}
if (!$client->query($method, $args)) {
if (litepublisher::$debug) {
tfiler::log('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
}
return false;
}
if (!isset($meta->ljid)) {
$response = $client->getResponse();
$meta->ljid = $response['itemid'];
}
return $meta->ljid;
}
示例2: checkUpdates
function checkUpdates()
{
require_once txpath . '/lib/IXRClass.php';
$client = new IXR_Client('http://rpc.textpattern.com');
$uid = safe_field('val', 'txp_prefs', "name='blog_uid'");
if (!$client->query('tups.getTXPVersion', $uid)) {
return gTxt('problem_connecting_rpc_server');
} else {
$msg = array();
$response = $client->getResponse();
if (is_array($response)) {
ksort($response);
$version = safe_field('val', 'txp_prefs', "name='version'");
$lversion = explode('.', $version);
$branch = substr($version, 0, 3);
foreach ($response as $key => $val) {
$rversion = explode('.', $val);
if ($key == 'txp_current_version_' . $branch) {
if (isset($lversion[2]) && isset($rversion[2]) && intval($rversion[2]) > intval($lversion[2])) {
$msg[] = gTxt('updated_branch_version_available');
} else {
$msg[] = gTxt('your_branch_is_updated');
}
} else {
if (intval($rversion[0]) > intval($lversion[0]) || intval($rversion[1]) > intval($lversion[1])) {
$msg[] = gTxt('new_textpattern_version_available') . ': ' . $val;
}
}
}
return $msg;
}
}
}
示例3: login
function login($username, $password)
{
$client = new IXR_Client($this->site . '/xmlrpc.php');
if (!$client->query('wp.getCategories', '', $username, $password)) {
return False;
}
return True;
}
示例4: getConnectedKeywords
function getConnectedKeywords($id)
{
if (!$this->client->query('contact.getConnectedKeywords', $this->credentials, $id)) {
trigger_error($this->client->getErrorCode() . ' : ' . $this->client->getErrorMessage());
return false;
}
return $this->client->getResponse();
}
示例5: capturePayment
function capturePayment($transactionnumber)
{
if (!$this->client->query('payment.capture', $this->credentials, $transactionnumber)) {
print $this->client->getErrorCode() . ' : ' . $this->client->getErrorMessage();
return false;
}
return $this->client->getResponse();
}
示例6: send
/**
* Envía mensajes a un array de destinatarios
*
* El array de entrada debe ser:
*
* $mensajes = array(
* array('637xxxxxx','texto del mensaje','texto que identifica al enviador'),
* //array(),
* );
*
* @param array $mensajes
* @return array
*/
static function send(array $mensajes)
{
if (count($mensajes)) {
$client = new IXR_Client(self::$url);
$client->query('MensajeriaNegocios.enviarSMS', self::$user, self::$passw, $mensajes);
return $client->getResponse();
}
}
示例7: addOnlinePayment
function addOnlinePayment($order_id, $transaction_number, $transaction_status, $amount)
{
if (!$this->client->query('payment.addOnlinePayment', $this->credentials, $order_id, $transaction_number, $transaction_status, $amount)) {
//if (!$client->query('products.test', $args)) {
trigger_error('An error occurred - ' . $this->client->getErrorCode() . ":" . $this->client->getErrorMessage());
}
return 1;
}
示例8: rpc
public static function rpc($url)
{
new Pinger();
//require_once( GX_LIB.'/Vendor/IXR_Library.php' );
$url = 'http://' . $url;
$client = new IXR_Client($url);
$client->timeout = 3;
$client->useragent .= ' -- PingTool/1.0.0';
$client->debug = false;
if ($client->query('weblogUpdates.extendedPing', self::$myBlogName, self::$myBlogUrl, self::$myBlogUpdateUrl, self::$myBlogRSSFeedUrl)) {
return $client->getResponse();
}
//echo 'Failed extended XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
if ($client->query('weblogUpdates.ping', self::$myBlogName, self::$myBlogUrl)) {
return $client->getResponse();
}
//echo 'Failed basic XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
return false;
}
示例9: action
/**
* Performs and action for the executed test case (i.e. sets the status of test case)
*
* @param string $method
* @param array $args
*
* @return array
*/
protected function action($method, $args)
{
$args["devKey"] = Mage_Testlink_Connector::$devKey;
if (!$this->_client->query("tl.{$method}", $args)) {
$response = null;
} else {
$response = $this->_client->getResponse();
}
return $response;
}
示例10: send
public function send($post, $blogurl, $username, $password)
{
if ($post && $blogurl && $username && $password) {
$title = $post['title'];
$description = $post['body'];
$selected_blog = $blogurl . "/xmlrpc.php";
$client = new IXR_Client("{$selected_blog}");
$content['title'] = $title;
$content['description'] = $description;
if (!$client->query('metaWeblog.newPost', '1', $username, $password, $content, 1)) {
die('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage());
}
}
}
示例11:
/**
* sends targets from OutputThis.
*
* @param integer id of destination.
*/
static function get_targets($username, $password)
{
Logger::log("Enter: function OutputThis::get_targets()");
$client = new IXR_Client('http://outputthis.org/xmlrpc.php');
if (!$client->query('outputthis.getPublishedTargets', $username, $password)) {
$error[0] = 'error';
$error[1] = 'Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage();
Logger::log("Exit: function OutputThis::get_targets()-Error in getting information from output this");
return $error;
} else {
$targets = $client->getResponse();
Logger::log("Exit: function OutputThis::get_targets()-getting information from outputthis successful");
return $targets;
}
}
示例12: submitFlightToServer
function submitFlightToServer($serverURL, $username, $passwd, $igcURL, $igcFilename, $private, $cat, $linkURL, $comments, $glider)
{
require_once dirname(__FILE__) . "/lib/xml_rpc/IXR_Library.inc.php";
$client = new IXR_Client($serverURL);
// $client->debug=true;
// echo "$username, $passwd, $igcURL, $igcFilename, $private, $cat, $linkURL, $comments, $glider #<BR>";
if (!$client->query('flights.submit', $username, $passwd, $igcURL, $igcFilename, $private, $cat, $linkURL, $comments, $glider)) {
//echo 'submitFlightToServer: Error '.$client->getErrorCode()." -> ".$client->getErrorMessage();
return array(0, $client->getErrorCode(), $client->getErrorMessage());
} else {
$flightID = $client->getResponse();
return array($flightID, '', '');
// echo 'Flight was submited with id '.$flightID;
}
// return $flightID;
}
示例13: xmlRpcPing
function xmlRpcPing($url)
{
global $myBlogName, $myBlogUrl, $myBlogUpdateUrl, $myBlogRSSFeedUrl;
$client = new IXR_Client($url);
$client->timeout = 3;
$client->useragent .= ' -- PingTool/1.0.0';
$client->debug = false;
if ($client->query('weblogUpdates.extendedPing', $myBlogName, $myBlogUrl, $myBlogUpdateUrl, $myBlogRSSFeedUrl)) {
return $client->getResponse();
}
// echo 'Failed extended XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
if ($client->query('weblogUpdates.ping', $myBlogName, $myBlogUrl)) {
return $client->getResponse();
}
// echo 'Failed basic XML-RPC ping for "' . $url . '": ' . $client->getErrorCode() . '->' . $client->getErrorMessage() . '<br />';
return false;
}
示例14: purge
/**
* Purges remote files
*
* @param array $files
* @param array $results
* @return boolean
*/
function purge($files, &$results)
{
if (empty($this->_config['apiid'])) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, 'Empty API ID.');
return false;
}
if (empty($this->_config['apikey'])) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, 'Empty API key.');
return false;
}
if ($this->_sha256('test') === false) {
$results = $this->_get_results($files, W3TC_CDN_RESULT_HALT, "hash() or mhash() function doesn't exists.");
return false;
}
if (!class_exists('IXR_Client')) {
require_once ABSPATH . WPINC . '/class-IXR.php';
}
if (function_exists('date_default_timezone_set')) {
$timezone = date_default_timezone_get();
date_default_timezone_set(W3TC_CDN_MIRROR_NETDNA_TZ);
}
$date = date('c');
$auth_string = sprintf('%s:%s:purge', $date, $this->_config['apikey']);
$auth_key = $this->_sha256($auth_string);
$client = new IXR_Client(W3TC_CDN_MIRROR_NETDNA_URL);
$client->timeout = 30;
$results = array();
foreach ($files as $local_path => $remote_path) {
$url = $this->format_url($remote_path);
$client->query('cache.purge', $this->_config['apiid'], $auth_key, $date, $url);
if (!$client->isError()) {
$val = $client->getResponse();
if ($val) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_OK, 'OK');
} else {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, 'Unable to purge.');
}
} else {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_HALT, sprintf('Unable to purge (%s).', $client->getErrorMessage()));
}
}
if (function_exists('date_default_timezone_set')) {
date_default_timezone_set($timezone);
}
return !$this->_is_error($results);
}
示例15: getNamespace
private function getNamespace($server, $check_method)
{
if (empty($this->methods)) {
$client = new \IXR_Client("http://{$server}:9001/RPC2/");
// $client->debug = true;
if (!$client->query('system.listMethods')) {
return false;
} else {
$methods = $client->getResponse();
foreach ($methods as $method) {
$parts = explode('.', $method);
$this->methods[$parts[1]] = $parts[0];
}
}
}
return $this->methods[$check_method];
}