public function __call($action, $arguments) { @(list($server, $option) = $arguments); if ($action == 'multicall') { $client = new \IXR_ClientMulticall("http://{$server}:9001/RPC2/"); $client->debug = true; foreach ((array) $option as $method) { $client->addCall($this->getNamespace($server, $action) . '.' . $method); } if (!$client->query()) { return array('error' => array('code' => $client->getErrorCode(), 'msg' => $client->getErrorMessage())); } } else { $args = array($this->getNamespace($server, $action) . '.' . $action); if ($option) { $args[] = $option; } $client = new \IXR_Client("http://{$server}:9001/RPC2/"); //$client->debug = true; if (!call_user_func_array(array($client, 'query'), $args)) { return array('error' => array('code' => $client->getErrorCode(), 'msg' => $client->getErrorMessage())); } } return $client->getResponse(); }
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(); }
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(); }
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; }
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; }
/** * This method is similar to call_user_func() in that you can pass any number of arguments beyond the required two, which will then call the remote XMLRPC method. * @param string $url * @param string $method * @return array (bool success,mixed response) */ function call($url, $method) { $client = new IXR_Client($url); if (defined('DEBUG_XMLRPC')) { $client->debug = true; } $args = func_get_args(); return !call_user_func_array(array($client, 'query'), array($method) + array_slice($args, 1)) ? array(false, $client->getErrorCode() . ' : ' . $client->getErrorMessage()) : array(true, $client->getResponse()); }
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()); } } }
/** * 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; } }
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; }
/** * 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); }
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; }
/** * 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; }
<?php require "functions/xmlrpc.php"; $client = new IXR_Client('http://192.168.1.2/denial/rpc.php'); $client->debug = true; if (!$client->query('blogger.getUsersBlogs', "943478217472357234234938249", "Kevin", "heh")) { die('<b>Error</b> ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage()); } else { $response = $client->getresponse(); }
function get_language() { global $prefs, $txpcfg, $textarray; require_once txpath . '/lib/IXRClass.php'; $lang_code = gps('lang_code'); $client = new IXR_Client(RPC_SERVER); // $client->debug = true; @set_time_limit(90); if (gps('force') == 'file' || !$client->query('tups.getLanguage', $prefs['blog_uid'], $lang_code)) { if ((gps('force') == 'file' || gps('updating') !== '1') && install_language_from_file($lang_code)) { if (defined('LANG')) { $textarray = load_lang(LANG); } return list_languages(gTxt($lang_code) . sp . gTxt('updated')); } else { $install_langfile = gTxt('install_langfile', array('{url}' => strong('<a href="' . RPC_SERVER . '/lang/">' . RPC_SERVER . '/lang/</a>'))); if ($install_langfile == 'install_langfile') { $install_langfile = 'To install new languages from file you can download them from <b><a href="' . RPC_SERVER . '/lang/">' . RPC_SERVER . '/lang/</a></b> and place them inside your ./textpattern/lang/ directory.'; } pagetop(gTxt('installing_language')); echo tag(gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->", 'p', ' style="text-align:center;color:red;width:50%;margin: 2em auto"'); echo tag($install_langfile, 'p', ' style="text-align:center;width:50%;margin: 2em auto"'); } } else { $response = $client->getResponse(); $lang_struct = unserialize($response); function install_lang_key(&$value, $key) { extract(gpsa(array('lang_code', 'updating'))); $exists = safe_field('name', 'txp_lang', "name='" . doSlash($value['name']) . "' AND lang='" . doSlash($lang_code) . "'"); $q = "name='" . doSlash($value['name']) . "', event='" . doSlash($value['event']) . "', data='" . doSlash($value['data']) . "', lastmod='" . doSlash(strftime('%Y%m%d%H%M%S', $value['uLastmod'])) . "'"; if ($exists) { $value['ok'] = safe_update('txp_lang', $q, "lang='" . doSlash($lang_code) . "' AND name='" . doSlash($value['name']) . "'"); } else { $value['ok'] = safe_insert('txp_lang', $q . ", lang='" . doSlash($lang_code) . "'"); } } array_walk($lang_struct, 'install_lang_key'); $size = count($lang_struct); $errors = 0; for ($i = 0; $i < $size; $i++) { $errors += !$lang_struct[$i]['ok']; } if (defined('LANG')) { $textarray = load_lang(LANG); } $msg = gTxt($lang_code) . sp . gTxt('updated'); if ($errors > 0) { $msg .= sprintf(" (%s errors, %s ok)", $errors, $size - $errors); } return list_languages($msg); } }
function get_cast_mdata_pull($ctx_age, $cast_mdata_ctx) { $cast_name = $cast_mdata_ctx['name']; // sanity check - $cast_mdata_ctx['type'] MUST be "pull" assert($cast_mdata_ctx['type'] == "pull"); do_log("slota"); do_log("ctx_age=" . $ctx_age); do_log("cast_mdata_ctx=" . print_r($cast_mdata_ctx, true)); // get the casti_srv_uri directly from $cast_mdata_ctx['arg']; $casti_srv_uri = $cast_mdata_ctx['arg']; // forward the xmlrpc to casti_srv_uri $client = new IXR_Client($casti_srv_uri); // $client->debug = true; if (!$client->query('get_cast_mdata', $cast_name)) { // delete the context file if it is now unreachable // unlink(cast_name_to_filepath($cast_name)); // forward the error to the caller return new IXR_Error($client->getErrorCode(), "slotaIXR" . $client->getErrorMessage()); } // get the cast_mdata $cast_mdata = $client->getResponse(); // return the $cast_mdata return $cast_mdata; }
function stats_get_blog_id($api_key) { $options = stats_get_options(); require_once ABSPATH . WPINC . '/class-IXR.php'; $client = new IXR_Client(STATS_XMLRPC_SERVER); extract(parse_url(get_option('home'))); $path = rtrim($path, '/'); if (empty($path)) { $path = '/'; } $client->query('wpStats.get_blog_id', $api_key, stats_get_blog()); if ($client->isError()) { if ($client->getErrorCode() == -32300) { $options['error'] = __('Your blog was unable to connect to WordPress.com. Please ask your host for help. (' . $client->getErrorMessage() . ')', 'stats'); } else { $options['error'] = $client->getErrorMessage(); } stats_set_options($options); return false; } else { $options['error'] = false; } $response = $client->getResponse(); $blog_id = isset($response['blog_id']) ? (int) $response['blog_id'] : false; $options['host'] = $host; $options['path'] = $path; $options['blog_id'] = $blog_id; stats_set_options($options); stats_set_api_key($api_key); return $blog_id; }
$client = new IXR_Client($server_url); $client->debug = $debug; new dBug($args); if (!$client->query($client_query, $args)) { echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage(); $response = null; } else { $response = $client->getResponse(); } echo "<br> Result was: "; new dBug($response); echo "<br>"; // ------------------------------------------------------------------------------------- $unitTestDescription = "Test - getTestSuitesForTestPlan"; $args = array(); $args["devKey"] = DEV_KEY; $args["testplanid"] = 61579; $debug = true; echo $unitTestDescription; $client = new IXR_Client($server_url); $client->debug = $debug; new dBug($args); if (!$client->query('tl.getTestSuitesForTestPlan', $args)) { echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage(); $response = null; } else { $response = $client->getResponse(); } echo "<br> Result was: "; new dBug($response); echo "<br>";
function reportResult($server_url, $tcaseid = null, $tcaseexternalid = null, $tplanid, $buildid = null, $buildname = null, $status, $notes = null, $bugid = null, $customfields = null, $platformname = null, $overwrite = false, $debug = false) { $client = new IXR_Client($server_url); $client->debug = $debug; $data = array(); $data["devKey"] = constant("DEV_KEY"); $data["testplanid"] = $tplanid; if (!is_null($bugid)) { $data["bugid"] = $bugid; } if (!is_null($tcaseid)) { $data["testcaseid"] = $tcaseid; } else { if (!is_null($tcaseexternalid)) { $data["testcaseexternalid"] = $tcaseexternalid; } } if (!is_null($buildid)) { $data["buildid"] = $buildid; } else { if (!is_null($buildname)) { $data["buildname"] = $buildname; } } if (!is_null($notes)) { $data["notes"] = $notes; } $data["status"] = $status; if (!is_null($customfields)) { $data["customfields"] = $customfields; } if (!is_null($platformname)) { $data["platformname"] = $platformname; } if (!is_null($overwrite)) { $data["overwrite"] = $overwrite; } new dBug($data); if (!$client->query('tl.reportTCResult', $data)) { echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage(); } else { return $client->getResponse(); } }
function cbrobot_queues() { ?> <script type="text/javascript" src="<?php bloginfo('wpurl'); ?> /wp-content/plugins/cbrobot/js/jquery.js"></script> <script type="text/javascript" src="<?php bloginfo('wpurl'); ?> /wp-content/plugins/cbrobot/js/jquery.validate.js"></script> <?php global $wpdb; $options = unserialize(get_option("cbrobot_options")); if ($_POST['cbrobot_create_queue_save']) { $error = array(); $blog_id = $_POST['cbrobot_bg_id']; $email = $_POST['cbrobot_bg_email']; $password = $_POST['cbrobot_bg_password']; $url = $_POST['cbrobot_bg_url']; $asin = $_POST['cbrobot_aa_asin']; if (!$blog_id) { echo '<div class="error"><p>***กรุณากรอก Blog Id***</p></div>'; $error[] = "E_ID"; } if (!$email) { echo '<div class="error"><p>***กรุณากรอก Email***</p></div>'; $error[] = "E_EMAIL"; } if (!$password) { echo '<div class="error"><p>***กรุณากรอก Password***</p></div>'; $error[] = "E_PASSWORD"; } if (!$url) { echo '<div class="error"><p>***กรุณากรอก URL***</p></div>'; $error[] = "E_URL"; } if (!$asin) { echo '<div class="error"><p>***กรุณากรอก Asin***</p></div>'; $error[] = "E_ASIN"; } if (count($error) == 0) { require_once "lib/content.php"; require_once "lib/xmlrpc.php"; $param = array(); /* Load XML Template Config */ $config = simplexml_load_file(ABSPATH . "/wp-content/plugins/cbrobot/template.xml"); $title = base64_decode($config->title); $content = base64_decode($config->content); $client = new IXR_Client('http://www.channgamsim.com/xmlrpc.php'); $params = array(0, $options['cbrobot_username'], $options['cbrobot_password'], $options['cbrobot_aa_affkey'], $options['cbrobot_aa_apikey'], $options['cbrobot_aa_secretkey'], $asin); if (!$client->query('demo.test', $params)) { echo '<div class="error">***' . $client->getErrorCode() . ' : ' . $client->getErrorMessage() . '***</div>'; } else { $obj_content = new Content(); $val = $client->message->params[0][Items][Item]; $title = $obj_content->getXML($val, $title, $keyword); $content = $obj_content->getXML($val, $content, $keyword); $title = Content::spin_content($title); $content = Content::spin_content($content); $sql = "INSERT INTO " . $wpdb->prefix . "cbrobot_queues (blog_id, blog_email, blog_password, blog_url, asin, title, content, queue_time)\r\n\t\t\t VALUES ('" . trim($blog_id) . "','" . trim($email) . "','" . trim($password) . "','" . trim($url) . "','" . trim($asin) . "',\r\n\t\t\t\t\t\t '" . trim(base64_encode($title)) . "','" . trim(base64_encode($content)) . "','" . time() . "');"; if ($result = $wpdb->query($sql)) { echo '<div class="updated"><p>' . __('Insert Queue.', 'cbrobot') . '</p></div>'; } else { echo '<div class="error">***Not Insert Data' . $result . '***</div>'; } } } else { ?> <script type="text/javascript" > $().ready(function() { $("#cbrobot_bg_id").val('<?php echo $blog_id; ?> '); $("#cbrobot_bg_email").val('<?php echo $email; ?> '); $("#cbrobot_bg_password").val('<?php echo $password; ?> '); $("#cbrobot_bg_url").val('<?php echo $url; ?> '); $("#cbrobot_aa_asin").val('<?php echo $asin; ?> '); }); </script> <?php } } if ($_GET['postdata']) { $id = $_GET['postdata']; post_data($id); } if ($_GET['delete']) { $id = $_GET['delete']; delete_data($id); } include_once "display-queues.php"; }
function pingback($content, $post_ID) { global $wp_version, $wpdb; include_once ABSPATH . WPINC . '/class-IXR.php'; // original code by Mort (http://mort.mine.nu:8080) $log = debug_fopen(ABSPATH . '/pingback.log', 'a'); $post_links = array(); debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n"); $pung = get_pung($post_ID); // Variables $ltrs = '\\w'; $gunk = '/#~:.?+=&%@!\\-'; $punc = '.:?\\-'; $any = $ltrs . $gunk . $punc; // Step 1 // Parsing the post, external links (if any) are stored in the $post_links array // This regexp comes straight from phpfreaks.com // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php preg_match_all("{\\b http : [{$any}] +? (?= [{$punc}] * [^{$any}] | \$)}x", $content, $post_links_temp); // Debug debug_fwrite($log, 'Post contents:'); debug_fwrite($log, $content . "\n"); // Step 2. // Walking thru the links array // first we get rid of links pointing to sites, not to specific files // Example: // http://dummy-weblog.org // http://dummy-weblog.org/ // http://dummy-weblog.org/post.php // We don't wanna ping first and second types, even if they have a valid <link/> foreach ($post_links_temp[0] as $link_test) { if (!in_array($link_test, $pung) && url_to_postid($link_test) != $post_ID && !is_local_attachment($link_test)) { // Also, let's never ping local attachments. $test = parse_url($link_test); if (isset($test['query'])) { $post_links[] = $link_test; } elseif ($test['path'] != '/' && $test['path'] != '') { $post_links[] = $link_test; } do_action('pre_ping', array(&$post_links, &$pung)); } } foreach ($post_links as $pagelinkedto) { debug_fwrite($log, "Processing -- {$pagelinkedto}\n"); $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); if ($pingback_server_url) { @set_time_limit(60); // Now, the RPC call debug_fwrite($log, "Page Linked To: {$pagelinkedto} \n"); debug_fwrite($log, 'Page Linked From: '); $pagelinkedfrom = get_permalink($post_ID); debug_fwrite($log, $pagelinkedfrom . "\n"); // using a timeout of 3 seconds should be enough to cover slow servers $client = new IXR_Client($pingback_server_url); $client->timeout = 3; $client->useragent .= ' -- WordPress/' . $wp_version; // when set to true, this outputs debug messages by itself $client->debug = false; if ($client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto)) { add_ping($post_ID, $pagelinkedto); } else { debug_fwrite($log, "Error.\n Fault code: " . $client->getErrorCode() . " : " . $client->getErrorMessage() . "\n"); } } } debug_fwrite($log, "\nEND: " . time() . "\n****************************\n"); debug_fclose($log); }
break; case 4: $float = "float: left;"; $tovana = $postText; break; default: $float = "float: left;"; $tovana = $postText; break; } $description = $tovona . "<div style=\"" . $float . " margin: 5px; width: " . ($sarywidth + 6) . "px;border: 1px solid #CCCCCC; padding: 3px;\"><a href=\"" . $blaogy_sary_url . "\" title=\"" . $USER->username . "\" style=\"text-decoration: none;\"><img src=\"" . $blaogy_sary_url . "\" width=\"" . $sarywidth . "\" alt=\"" . $USER->username . "\" border=\"0\" /></a></div>" . $tovana; $struc = array("title" => htmlentities($postTitle, ENT_QUOTES), "description" => nl2br($description) . "<br clear=\"all\" />"); if ($client->query('metaWeblog.newPost', $blaogy[0]["blogid"], $USER->username, $hash, $struc, true)) { $x_body .= "Tafiditra soa amantsara ao amin'ny blaogy ilay sary teo. Jereo ao amin'ny blaoginao <a href=\"http://" . $USER->username . ".blaogy.com\">http://" . $USER->username . ".blaogy.com</a>"; } else { $x_body .= "Nisy olana ka tsy tafiditra ny sary. Ilazao i Hery azafady dia lazao aminy ity hadisoana eto ambany ity : <br /><b>" . $client->getErrorMessage() . "</b>"; } } else { $x_body .= "Tsy azonao ampidirina amin'ny blaoginao ny sarin'olona hafa"; } } else { //saisie $x_body .= "\r\n\t\t\t\t\t\t\tRaha tianao hapetraka miaraka amin'ny lahatsoratra any amin'ny blaoginao io sary io dia apetraho eto ambany ny lohateny sy ny lahatsoratra<br />\r\n\t\t\t\t\t\t\tNy sarinao ihany no azonao ampidirina amin'ny blaoginao.<br />\r\n\t\t\t\t\t\t\t<form method='post' action='' onSubmit=\"this.bouton.value='Mahandrasa kely...';this.bouton.disabled=true;\">\r\n\t\t\t\t\t\t\t<input type='hidden' name='saryid' value='{$saryid}'>\r\n\t\t\t\t\t\t\t<input type='hidden' name='rub' value='{$rub}'>\r\n\t\t\t\t\t\t\t<input type='hidden' name='asa' value='{$asa}'>\r\n\t\t\t\t\t\t\t<input type='hidden' name='hash' value='{$hash}'>\r\n\t\t\t\t\t\t\t<input type='hidden' name='alefa' value='" . md5('alefa') . "'>\r\n\t\t\t\t\t\t\t<table>\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t\t<b>Lohateny : </b>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t\t<input type='text' name='postTitle' value='' class='gen_input'>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t\t<b>Lahatsoratra : </b>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t\t<textarea name='postText' rows='10' cols='35' class='gen_input' ></textarea>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t\t<b>Toeran'ny sary : </b>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td valign='top'>\r\n\t\t\t\t\t\t\t\t\t<input type='radio' name='postPicpos'value='4' checked> Ankavian'ny lahatsoratra<br />\r\n\t\t\t\t\t\t\t\t\t<input type='radio' name='postPicpos'value='2' > Ankavanan'ny lahatsoratra<br />\r\n\t\t\t\t\t\t\t\t\t<input type='radio' name='postPicpos'value='1' > Ambonin'ny lahatsoratra<br />\r\n\t\t\t\t\t\t\t\t\t<input type='radio' name='postPicpos'value='3' > Ambanin'ny lahatsoratra<br />\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td valign='top' align='center' colspan='2'>\r\n\t\t\t\t\t\t\t\t\t<input type='submit' name='bouton' value=' Alefa '>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t</table>\r\n\t\t\t\t\t\t\t</form>\r\n\t\t\t\t\t\t\t"; } } } } else { $x_body .= "Tsy nifidy sary halefa any amin'ny blaogy ianao"; } break; case "del":
function mediacp_api($api) { $client = new IXR_Client($api['path'] . "/system/rpc.php"); if (isset($_GET['debug'])) { $client->debug = true; echo "Integration Version: " . date("d-m-Y.", filemtime(__FILE__)) . "<br />\n"; print_r($api); echo "<br />\n"; } if (!$client->query($api['rpc'], $api['args'])) { exit("An error occurred - " . $client->getErrorCode() . ":" . $client->getErrorMessage()); } return $client->getResponse(); }
function get_language() { global $prefs, $textarray; require_once txpath . '/lib/IXRClass.php'; $lang_code = gps('lang_code'); $client = new IXR_Client(RPC_SERVER); // $client->debug = true; @set_time_limit(90); if (gps('force') == 'file' || !$client->query('tups.getLanguage', $prefs['blog_uid'], $lang_code)) { if ((gps('force') == 'file' || gps('updating') !== '1') && install_language_from_file($lang_code)) { if (defined('LANG')) { $textarray = load_lang(LANG); } return list_languages(gTxt($lang_code) . sp . gTxt('updated')); } else { pagetop(gTxt('installing_language')); echo tag(gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->", 'p', ' class="error lang-msg"'); } } else { $response = $client->getResponse(); $lang_struct = unserialize($response); if ($lang_struct === false) { $errors = $size = 1; } else { function install_lang_key(&$value, $key) { extract(gpsa(array('lang_code', 'updating'))); $exists = safe_field('name', 'txp_lang', "name='" . doSlash($value['name']) . "' AND lang='" . doSlash($lang_code) . "'"); $q = "name='" . doSlash($value['name']) . "', event='" . doSlash($value['event']) . "', data='" . doSlash($value['data']) . "', lastmod='" . doSlash(strftime('%Y%m%d%H%M%S', $value['uLastmod'])) . "'"; if ($exists) { $value['ok'] = safe_update('txp_lang', $q, "lang='" . doSlash($lang_code) . "' AND name='" . doSlash($value['name']) . "'"); } else { $value['ok'] = safe_insert('txp_lang', $q . ", lang='" . doSlash($lang_code) . "'"); } } array_walk($lang_struct, 'install_lang_key'); $size = count($lang_struct); $errors = 0; for ($i = 0; $i < $size; $i++) { $errors += !$lang_struct[$i]['ok']; } if (defined('LANG')) { $textarray = load_lang(LANG); } } $msg = gTxt($lang_code) . sp . gTxt('updated'); if ($errors > 0) { $msg = array($msg . sprintf(" (%s errors, %s ok)", $errors, $size - $errors), E_ERROR); } return list_languages($msg); } }
function executeTestCase($server_url, $context, $exec, $debug = false) { new dBug($context); new dBug($exec); $client = new IXR_Client($server_url); $client->debug = $debug; $data = array(); $data["devKey"] = 'admin'; $data["status"] = $exec->status; if (property_exists($exec, 'user') && !is_null($exec->user)) { $data["user"] = $exec->user; } if (property_exists($exec, 'notes') && !is_null($exec->notes)) { $data["notes"] = $exec->notes; } if (property_exists($exec, 'bugid') && !is_null($exec->bugid)) { $data["bugid"] = $exec->bugid; } if (property_exists($exec, 'overwrite') && !is_null($exec->overwrite)) { $data["overwrite"] = $exec->overwrite; } if (property_exists($exec, 'customfields') && !is_null($exec->customfields)) { $data["customfields"] = $customfields; } if (property_exists($exec, 'timestamp') && !is_null($exec->timestamp)) { $data["timestamp"] = $exec->timestamp; } $data["testplanid"] = $context->testplanid; if (property_exists($context, 'testcaseid') && !is_null($context->testcaseid)) { $data["testcaseid"] = $context->testcaseid; } else { if (property_exists($context, 'testcaseexternalid') && !is_null($context->testcaseexternalid)) { $data["testcaseexternalid"] = $context->testcaseexternalid; } } if (property_exists($context, 'buildid') && !is_null($context->buildid)) { $data["buildid"] = $context->buildid; } else { if (property_exists($context, 'buildname') && !is_null($context->buildname)) { $data["buildname"] = $context->buildname; } } if (property_exists($context, 'platformname') && !is_null($context->platformname)) { $data["platformname"] = $context->platformname; } new dBug($data); if (!$client->query('tl.reportTCResult', $data)) { echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage(); } else { return $client->getResponse(); } }
//wordpress post require_once "IXR_Library.php.inc"; //$client->debug = false; //Set it to false in Production Environment $title = ''; // $title variable will insert your blog title $body = ''; // $body will insert your blog content (article content) $category = ","; // Comma seperated pre existing categories. Ensure that these categories exists in your blog. $keywords = ""; $customfields = array('icon' => '123', 'developer' => 'Autor Bio Here'); // Insert your custom values like this in Key, Value format //$customfields=array('icon'=>'123', 'developer'=>'Autor Bio Here'); // Insert your custom values like this in Key, Value format //meta $title = htmlentities($title, ENT_NOQUOTES, $encoding); $keywords = htmlentities($keywords, ENT_NOQUOTES, $encoding); $content = array('title' => $title, 'description' => $body, 'mt_allow_comments' => 0, 'mt_allow_pings' => 0, 'post_type' => 'post', 'mt_keywords' => $keywords, 'categories' => array($category), 'customfields' => array($customfields)); // Create the client object $client = new IXR_Client('http://url/xmlrpc.php'); $username = "******"; $password = "******"; $params = array(0, $username, $password, $content, true); // Last parameter is 'true' which means post immideately, to save as draft set it as 'false' //print_r( $content ); // Run a query for PHP if (!$client->query('metaWeblog.newPost', $params)) { die('Something went wrong - ' . $client->getErrorCode() . ' : ' . $client->getErrorMessage()); } else { echo "<p>Article Posted Successfully {$title}</p>"; }
function ljxp_delete($post_id) { // Pull the post_id $ljxp_post_id = get_post_meta($post_id, 'ljID', true); $errors = array(); // Ensures that there's actually a value. If the post was never // cross-posted, the value wouldn't be set, and there's no point in // deleting entries that don't exist if ($ljxp_post_id == 0) { return $post_id; } $options = ljxp_get_options(); // And open the XMLRPC interface $client = new IXR_Client($options['host'], '/interface/xmlrpc'); // Request the challenge for authentication if (!$client->query('LJ.XMLRPC.getchallenge')) { $errors[$client->getErrorCode()] = $client->getErrorMessage(); } // And retrieve the challenge that LJ returns $response = $client->getResponse(); $challenge = $response['challenge']; // Most of this is the same as before. The important difference is the // value of $args[event]. By setting it to a null value, LJ deletes the // entry. Really rather klunky way of doing things, but not my code! $args = array('username' => $options['username'], 'auth_method' => 'challenge', 'auth_challenge' => $challenge, 'auth_response' => md5($challenge . $options['password']), 'itemid' => $ljxp_post_id, 'event' => "", 'subject' => "Delete this entry", 'year' => date('Y'), 'mon' => date('n'), 'day' => date('j'), 'hour' => date('G'), 'min' => date('i'), 'usejournal' => !empty($options['community']) ? $options['community'] : $options['username']); // And awaaaayyy we go! if (!$client->query('LJ.XMLRPC.editevent', $args)) { $errors[$client->getErrorCode()] = $client->getErrorMessage(); } delete_post_meta($post_id, 'ljID'); delete_post_meta($post_id, 'ljURL'); update_option('ljxp_error_notice', $errors); return $post_id; }
function test_connection($site) { $domain = $site['name']; $client = new IXR_Client("http://{$domain}/xmlrpc.php"); if ($client->query("wp.getUsersBlogs", $site['username'], $site['password'])) { return "OK"; } return $client->getErrorMessage(); }
<?php require './roots.php'; require_once $root_path . 'include/inc_environment_global.php'; require_once $root_path . 'classes/ixr_library.inc.php'; $client = new IXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php'); $client->query('test.getTime'); print $client->getResponse(); // Prints the current time, according to our web server $test = new IXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php'); if (!$test->query('test.addArray', array(3, 5, 7))) { die('An error occurred - ' . $test->getErrorCode() . ":" . $test->getErrorMessage()); } print $test->getResponse(); $client = new IXR_Client('http://scripts.incutio.com/xmlrpc/simpleserver.php'); if (!$client->query('test.add', 4, 5)) { die('An error occurred - ' . $client->getErrorCode() . ":" . $client->getErrorMessage()); } print $client->getResponse(); ?>
/** * Installs a language from the RPC server or from a file. * * This function fetches language strings for the given language code from * either the RPC server or a file. * * Action is taken based on three HTTP POST parameters: 'lang_code', 'force' and * 'updating'. The 'lang_code' is the installed langauge, e.g. 'en-gb', 'fi-fi'. * The 'force' when set to 'file' can be used force an installation from a local * file. The 'updating' specifies whether only to install (0) or to update (1). */ function get_language() { global $prefs, $textarray; require_once txpath . '/lib/IXRClass.php'; $lang_code = gps('lang_code'); $client = new IXR_Client(RPC_SERVER); // $client->debug = true; @set_time_limit(90); // TODO: 90 seconds: seriously? if (gps('force') == 'file' || !$client->query('tups.getLanguage', $prefs['blog_uid'], $lang_code)) { if ((gps('force') == 'file' || gps('updating') !== '1') && install_language_from_file($lang_code)) { if (defined('LANG')) { $textarray = load_lang(LANG); } callback_event('lang_installed', 'file', false, $lang_code); return list_languages(gTxt($lang_code) . sp . gTxt('updated')); } else { pagetop(gTxt('installing_language')); echo graf('<span class="ui-icon ui-icon-closethick"></span> ' . gTxt('rpc_connect_error') . "<!--" . $client->getErrorCode() . ' ' . $client->getErrorMessage() . "-->", array('class' => 'alert-block error')); } } else { $response = $client->getResponse(); $lang_struct = unserialize($response); if ($lang_struct === false) { $errors = $size = 1; } else { array_walk($lang_struct, 'install_lang_key'); $size = count($lang_struct); $errors = 0; for ($i = 0; $i < $size; $i++) { $errors += !$lang_struct[$i]['ok']; } if (defined('LANG')) { $textarray = load_lang(LANG); } } $msg = gTxt($lang_code) . sp . gTxt('updated'); callback_event('lang_installed', 'remote', false, $lang_code); if ($errors > 0) { $msg = array($msg . sprintf(" (%s errors, %s ok)", $errors, $size - $errors), E_ERROR); } list_languages($msg); } }
public function ping($siteName, $siteURL, $pageURL) { require_once 'IXR_Library.inc.php'; // Что посылаем в пингах // Название сайта // $siteName = 'WEB-технологии'; // // Адрес сайта // $siteURL = 'http://htmlweb.ru/'; // // Адрес страницы, которая изменилась (например) // $pageURL = 'http://htmlweb.ru/news/test.html'; // // Адрес страницы с фидом $feedURL = 'http://htmlweb.ru/news.rss'; /** * Яндекс.Блоги */ $pingClient = new IXR_Client('ping.blogs.yandex.ru', '/RPC2'); // Посылаем challange-запрос if (!$pingClient->query('weblogUpdates.ping', $siteName, $siteURL, $pageURL)) { echo 'Ошибка ping-запроса [' . $pingClient->getErrorCode() . '] ' . $pingClient->getErrorMessage(); } else { echo 'Послан ping Яндексу'; } /** * Google */ $pingClient = new IXR_Client('blogsearch.google.com', '/ping/RPC2'); // Посылаем challange-запрос if (!$pingClient->query('weblogUpdates.extendedPing', $siteName, $siteURL, $pageURL, $feedURL)) { echo 'Ошибка ping-запроса [' . $pingClient->getErrorCode() . '] ' . $pingClient->getErrorMessage(); } else { echo 'Послан ping Google'; } }