Exemple #1
0
 public function getServiceConfig()
 {
     return array('factories' => array('Changelog\\XmlRpc\\Client' => function ($services) {
         $config = $services->get('Config');
         if (!isset($config['changelog'])) {
             throw new RuntimeException('Expecting a "changelog" key in configuration; none found');
         }
         $config = $config['changelog'];
         if (!isset($config['jira']) || !is_array($config['jira'])) {
             throw new RuntimeException('Expecting an array of JIRA credentials in "changelog" configuration; none found');
         }
         $jiraUrl = isset($config['jira']['url']) ? $config['jira']['url'] : 'http://framework.zend.com/issues/rpc/xmlrpc';
         $cxn = new XmlRpcClient($jiraUrl);
         $client = $cxn->getProxy('jira1');
         return $client;
     }, 'Changelog\\Jira\\Auth' => function ($services) {
         $config = $services->get('Config');
         if (!isset($config['changelog'])) {
             throw new RuntimeException('Expecting a "changelog" key in configuration; none found');
         }
         $config = $config['changelog'];
         if (!isset($config['jira']) || !is_array($config['jira'])) {
             throw new RuntimeException('Expecting an array of JIRA credentials in "changelog" configuration; none found');
         }
         $jiraCredentials = $config['jira'];
         $client = $services->get('Changelog\\XmlRpc\\Client');
         $auth = $client->login($jiraCredentials['username'], $jiraCredentials['password']);
         return $auth;
     }, 'Changelog\\Http\\Client' => function ($services) {
         $client = new HttpClient();
         $client->setOptions(array('adapter' => 'Zend\\Http\\Client\\Adapter\\Curl', 'keepalive' => true, 'timeout' => 10));
         return $client;
     }));
 }
 /**
  * @param string     $username
  * @param string     $password
  * @param string     $hostname
  * @param int        $port
  * @param null|mixed $logger
  */
 public function __construct($username, $password, $hostname = '127.0.0.1', $port = 9001, $logger = null)
 {
     $this->_logger = $logger;
     // Connect to Supervsior XMLRPC server
     // MUST add '/RPC2' to URI!!!
     $xmlRpcClient = new Client("http://{$username}:{$password}@{$hostname}:{$port}/RPC2");
     $xmlRpcClient->setSkipSystemLookup(true);
     $this->_service = $xmlRpcClient->getProxy();
 }
 /**
  * @param array $domainNames domain names
  * @param array $options
  * @return mixed
  */
 public function isAvailable(array $domainNames, array $options = null)
 {
     $maxRetry = 0;
     $gandi = $this->gandi->getProxy('domain');
     $results = $gandi->available($this->api_key, $domainNames, $options);
     foreach ($results as $domain => $result) {
         if ('pending' == $result) {
             $maxRetry++;
             //if max retry has expired, return the data as it.
             if ($maxRetry > self::MAX_TIMEOUT) {
                 return $this->convertDomainListToUTF8($results);
             }
             sleep(1);
             return $this->isAvailable($domainNames);
         }
     }
     return $this->convertDomainListToUTF8($results);
 }
Exemple #4
0
 public function getProxy($namespace = '')
 {
     if (empty($this->_proxyCache[$namespace])) {
         $this->_proxyCache[$namespace] = new PythonSimpleXMLRPCServerWithUnsupportedIntrospection($this, $namespace);
     }
     return parent::getProxy($namespace);
 }
 /**
  * @param Zend\XmlRpc\Client $client
  */
 public function __construct(XMLRPCClient $client)
 {
     $this->_system = $client->getProxy('system');
 }
<?php

/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 * @package   Zend_XmlRpc
 */
use Zend\Loader\StandardAutoloader;
use Zend\XmlRpc\Client;
require_once dirname(dirname(dirname(__DIR__))) . '/library/Zend/Loader/StandardAutoloader.php';
$loader = new StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
$server = new Client('http://www.upcdatabase.com/xmlrpc');
$client = $server->getProxy();
print_r($client->lookup(array('rpc_key' => '0000...0000', 'upc' => '123456789012')));
Exemple #7
0
 /**
  * @return String
  */
 private function getCurrentGrid()
 {
     $gandi = $gandi = $this->gandi->getProxy('contact');
     $result = $gandi->balance($this->api_key);
     return $result['grid'];
 }