/** * XMLRPC user list */ public function xmlrpcgetuserlistAction() { $client = new Zend_XmlRpc_Client('http://front.zend.local/Wsserver/index/xmlrpc'); $systemService = $client->getProxy('system'); $userService = $client->getProxy('user'); $string = $userService->testString(); var_dump( $string ); $object = $userService->testObject(); var_dump( $object ); $array = $userService->testArray(); var_dump( $array ); $array = $userService->testArray2(); var_dump( $array ); $arrayOfOjects = $userService->listUsers(); var_dump( $arrayOfOjects ); $methods = $systemService->listMethods(); print_r( $methods ); $help = $systemService->methodSignature( 'user.authenticate' ); print_r( $help ); exit; }
public function deleteTicket($id) { $proxy = $this->_client->getProxy('ticket'); // int ticket.delete(int id) $result = $proxy->delete($id); return $result === 0; }
public function testServerProxyCachesNestedProxies() { $proxy = $this->xmlrpcClient->getProxy(); $foo = $proxy->foo; $this->assertSame($foo, $proxy->foo); $bar = $proxy->foo->bar; $this->assertSame($bar, $proxy->foo->bar); }
public function xmlrpcConsoleAction() { $serverUrl = str_replace('console', 'server', MAIN_URL . $this->getRequest()->getRequestUri()); $client = new Zend_XmlRpc_Client($serverUrl); $example = $client->getProxy('example'); echo $example->getTime(); exit; }
/** * Create a new connection to a R1soft server. * * @param string $host Hostname or IP address of the R1soft server. * @param string $username * @param string $password * @param bool $secure Use HTTPS */ public function __construct( $host, $username, $password, $secure = true ) { if( $secure ) { $this->_fullUrl = sprintf( 'https://%s:%s@%s:%d/xmlrpc', $username, $password, $host, self::PORT_SECURE ); $this->_client = new Zend_XmlRpc_Client( $this->_fullUrl, new Zend_Http_Client( null, array( 'ssltransport' => 'sslv3', //ssl does not properly detect v3 ) ) ); } else { $this->_fullUrl = sprintf( 'http://%s:%s@%s:%s/xmlrpc', $username, $password, $host, self::PORT_UNSECURE ); $this->_client = new Zend_XmlRpc_Client( $this->_fullUrl ); } $this->_proxy = $this->_client->getProxy(); $this->_testConnection(); }
/** * This returns a Zend_XmlRpc_Client instance - unless we can't log you in... */ function get_xmlrpc() { global $CONF; require_once 'Zend/XmlRpc/Client.php'; $client = new Zend_XmlRpc_Client($CONF['xmlrpc_url']); $http_client = $client->getHttpClient(); $http_client->setCookieJar(); $login_object = $client->getProxy('login'); if (empty($_SESSION['password'])) { if (empty($_POST['password'])) { _display_password_form(); exit(0); } else { try { $success = $login_object->login($_SESSION['username'], $_POST['password']); } catch (Exception $e) { //var_dump($client->getHttpClient()->getLastResponse()->getBody()); error_log("Failed to login to xmlrpc instance - " . $e->getMessage()); die('Failed to login to xmlrpc instance'); } if ($success) { $_SESSION['password'] = $_POST['password']; // reload the current page as a GET request. header("Location: {$_SERVER['REQUEST_URI']}"); exit(0); } else { _display_password_form(); exit(0); } } } else { $success = $login_object->login($_SESSION['username'], $_SESSION['password']); } if (!$success) { unset($_SESSION['password']); die("Invalid details cached... refresh this page and re-enter your mailbox password"); } return $client; }
public static function post($message) { // получаем конфиг из application.ini try { $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'lj'); } catch (Exception $e) { throw new Exception('Config load error. Check your application.ini. ' . $e); } // создаем новый объект класса Zend_XmlRpc_Client и передаем ему адрес сервера $client = new Zend_XmlRpc_Client('http://www.livejournal.com/interface/xmlrpc'); // получаем объект прокси, при этом передаем ему пространство имен $proxy = $client->getProxy('LJ.XMLRPC'); try { //получаем challenge для авторизации $challenge = $proxy->getchallenge(); } catch (Exception $e) { throw new Exception('Connection fail. Get challenge fail. ' . $e); } $data = array('username' => $config->username, 'auth_method' => $config->auth_method, 'auth_challenge' => $challenge['challenge'], 'auth_response' => md5($challenge['challenge'] . md5($config->password)), 'ver' => $config->protocol_version, 'lineendings' => $config->lineendings, 'subject' => $message['title'], 'event' => $message['text'], 'day' => date('d'), 'mon' => date('m'), 'year' => date('Y'), 'hour' => date('H'), 'min' => date('i'), 'security' => 'public', 'props' => array('opt_preformatted' => true, 'opt_backdated' => true, 'taglist' => $message['tags']), 'usejournal' => $config->community); //отправляем данные на сервер try { $p_data = $proxy->postevent($data); } catch (Exception $e) { throw new Exception('Post failed. ' . $e); } /* если все нормально, то сервер вернет структуру с 3-мя переменными: itemid - идентификатор поста url - URL-адрес поста anum - аутентификационный номер, созданный для этой записи */ if (empty($p_data)) { echo 'Livejournal connection failed.'; return $p_data; } else { return $p_data; } }
/** * @param Zend_XmlRpc_Client $client */ public function __construct(Zend_XmlRpc_Client $client) { $this->_system = $client->getProxy('system'); }
public function getProxy($namespace = '') { if (empty($this->_proxyCache[$namespace])) { $this->_proxyCache[$namespace] = new Python_SimpleXMLRPCServerWithUnsupportedIntrospection($this, $namespace); } return parent::getProxy($namespace); }
public function xmlrpcConsoleAction() { $client = new Zend_XmlRpc_Client(MAIN_URL . '/example/service/rpc-server'); $member = $client->getProxy('member'); }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_XmlRpc * @subpackage Demos * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** * @see Zend_XmlRpc_Client */ require_once 'Zend/XmlRpc/Client.php'; $server = new Zend_XmlRpc_Client('http://www.upcdatabase.com/rpc'); $client = $server->getProxy(); print_r($client->lookupUPC('071641301627'));
/** * @param Zend_XmlRpc_Client $client */ public function __construct($client) { $this->_system = $client->getProxy('system'); }
/** * Pingback from Wikidot page (source URI) to external page (target URI) * * @throws PingBackException if pinging is not successfull * @throws PingBackNotAvailableException when the target is not PingBack enabled * @return string the endpoint return value */ public function ping() { try { $rpc = new Zend_XmlRpc_Client($this->getExternalPingBackURI()); $srv = $rpc->getProxy('pingback'); return $srv->ping($this->wikidotURI, $this->externalURI); } catch (Zend_Http_Client_Adapter_Exception $e) { throw new PingBackException("HTTP Error: " . $e->getMessage()); } catch (Zend_Http_Client_Exception $e) { throw new PingBackException("HTTP Error: " . $e->getMessage()); } catch (Zend_XmlRpc_Client_FaultException $e) { throw new PingBackException("XMLRCP Error: " . $e->getMessage(), $e->getCode()); } catch (PingBackException $e) { throw new PingBackException("Pingback Error: " . $e->getMessage()); } catch (Exception $e) { throw new PingBackException("Unknown Error: " . $e->getMessage()); } }
/** * Обработать сообщение и выдать результат анализа. * * @param ISF_Message $message сообщение * @param string $domain поддомен, относительно которого обрабатывать сообщение * @return string результат анализа */ public function messageInput(ISF_Message $message, $domain = null) { $params = array('partner' => $this->getPartnerAuth(), 'message' => $message->serialize()); if ($domain !== null) { $params['domain'] = (string) $domain; } try { $result = $this->api_transport->getProxy()->sf->message->input($params); return $result['result']; } catch (Zend_XmlRpc_Client_FaultException $e) { throw new SF_API_Error($e->getMessage(), $e->getCode()); } }
<?php $p = (double) $_POST['p']; $i = $_POST['i']; $n = (int) $_POST['n']; $t = $_POST['t']; $a = (int) $_POST['a']; $i = (double) str_replace(',', '.', $i); require 'startzend.php'; $client = new Zend_XmlRpc_Client('http://localhost/xmlgenerator/remote3.php'); $proxy = $client->getProxy('calculadora'); $m = $proxy->calculaMontante($p, $i, $n, $a); $l = $m - $p; //formatação $l = str_replace('.', ',', $l); $p = str_replace('.', ',', $p); $i = str_replace('.', ',', $i * 100); $m = str_replace('.', ',', $m); $mensagem = "Um capital de R\$ {$p}, aplicado a uma taxa de juros de {$i}%, durante {$n} {$t} renderá R\$ {$l}"; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <?php echo $mensagem; ?>