本文整理匯總了PHP中IXR_Client類的典型用法代碼示例。如果您正苦於以下問題:PHP IXR_Client類的具體用法?PHP IXR_Client怎麽用?PHP IXR_Client使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了IXR_Client類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}
}
}
示例2: 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();
}
}
示例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: 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());
}
}
}
示例5: get_targets
/**
* 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;
}
}
示例6: sms_to_wordpress
function sms_to_wordpress($sms)
{
$config = sms_to_wordpress_initialize();
$message = $sms->TextDecoded;
$number = $sms->SenderNumber;
list($code) = explode(" ", $message);
$wordpress_code = $config['wordpress_code'];
$wordpress_post = trim(str_replace($config['wordpress_code'], '', $message));
if (strtoupper($code) == strtoupper($wordpress_code)) {
$CI =& get_instance();
$CI->load->model('sms_to_wordpress/sms_to_wordpress_model', 'plugin_model');
include_once 'libraries/IXR_Library.php';
// if wp url exist
$wp = $CI->plugin_model->get_wp_url_by_phone($number);
if (is_array($wp)) {
$client = new IXR_Client($wp['wp_url']);
// Post parameter
$post = array('title' => 'Post from SMS', 'description' => $wordpress_post, 'post_type' => 'post', 'post_status' => 'publish', 'mt_keywords' => 'sms,kalkun', 'publish' => 1);
$CI->load->library('encrypt');
$wp_pass = $CI->encrypt->decode($wp['wp_password']);
// Debug ON. Now you know what's going on.
//$client->debug = true;
// Execute
$res = $client->query('metaWeblog.newPost', '', $wp['wp_username'], $wp_pass, $post);
}
}
}
示例7: 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;
}
示例8: 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);
}
示例9: 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];
}
示例10: 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;
}
示例11: get_palina
function get_palina($palina_id, $api_key)
{
// mi autentico per ottenere il token
$client = new IXR_Client("http://muovi.roma.it/ws/xml/autenticazione/1");
if (!$client->query('autenticazione.Accedi', $api_key, '')) {
echo '<br>An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage();
}
$token = $client->getResponse();
// mostra il token
//echo "<br><br>TOKEN-> ".$token;
// richiamo il ws per la ricerca del percorso
$client = new IXR_Client("http://muovi.roma.it/ws/xml/paline/7");
if (!$client->query('paline.Previsioni', $token, (int) $palina_id, "it")) {
echo '<br>An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage();
}
$response = $client->getResponse();
return $response;
}
示例12: 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;
}
示例13: 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;
}
示例14: api_request
/**
* api_request
*
* Handles any request made to the Syndication Toolkit Master wordpress install via cURL
*
* @param string $method
* @param array $params
* @return mixed $results
* @access public
* @author Ben Moody
*/
public function api_request($method, $params)
{
//Init vars
$client = NULL;
$results = NULL;
$request = NULL;
$ch = NULL;
$results = NULL;
$response_code = NULL;
$errorno = NULL;
$error = NULL;
//include Incutio XML-RPC Library from wordpress core
require PRSOSYNDTOOLKITREADER__XMLRPC_LIB;
$client = new IXR_Client($this->xml_rpc_url);
if (!$client->query($method, $params, $this->username, $this->password)) {
return array('errorCode' => $client->getErrorCode(), 'errorMsg' => $client->getErrorMessage());
}
$results = $client->getResponse();
return $results;
}
開發者ID:anthonyeden,項目名稱:prso-content-syndication-toolkit-reader,代碼行數:31,代碼來源:class.prso-syd-reader-xmlrpc.php
示例15: get_current_info
public function get_current_info($version, $force = false, $plugin = false)
{
include_once ABSPATH . 'wp-includes/class-IXR.php';
global $frm_update;
$client = new IXR_Client($frm_update->pro_mothership_xmlrpc_url, false, 80, $frm_update->timeout);
$force = $force ? 'true' : 'false';
$plugin = $plugin ? $plugin : $this->plugin_nicename;
if (!$client->query('proplug.get_current_info', $frm_update->pro_username, $frm_update->pro_password, $version, $force, get_option('siteurl'), $plugin)) {
return false;
}
return $client->getResponse();
}