/**
  * Gandi API call
  * 
  * @param string $method
  * @param array $params
  * @return array
  */
 private function _call($method, $params = NULL)
 {
     try {
         return $this->_client->call($method, $params);
     } catch (Zend_XmlRpc_Client_FaultException $e) {
         throw new Exception('Fault Exception: ' . $e->getCode() . "\n" . $e->getMessage());
     }
 }
예제 #2
0
파일: Key.php 프로젝트: uibar/peggysgift
 /**
  * Get license key inforamtion
  * @param string $licenseKey
  */
 public function getKeyInfo($licenseKey)
 {
     $licenseKey = $this->encode($licenseKey, self::ENCODED_KEY);
     $client = new Zend_XmlRpc_Client(self::VNECOMS_XMLRPC);
     $client->getHttpClient()->setConfig(array('timeout' => 1200));
     $session = $client->call('login', array(self::VNECOMS_API_USERNAME, self::VNECOMS_API_PASSWORD));
     $result = $client->call('call', array($session, 'license.get_license_info', array($licenseKey)));
     $client->call('endSession', array($session));
     return $result;
 }
예제 #3
0
 public function process($data = array(), $type = 'invoice', $pdfPro)
 {
     $client = new Zend_XmlRpc_Client($pdfPro->decode(PdfPro::PDF_PRO_XMLRPC, '5e6bf967aab429405f5855145e6e0fa7'));
     $client->getHttpClient()->setConfig(array('timeout' => 1200));
     $session = $client->call('login', array($pdfPro->decode(PdfPro::PDF_PRO_API_USERNAME, '5e6bf967aab429405f5855145e6e0fa7'), $pdfPro->decode(PdfPro::PDF_PRO_API_PASSWORD, '5e6bf967aab429405f5855145e6e0fa7')));
     $result = $client->call('call', array($session, 'pdfpro.getPdf', array($pdfPro->encode(json_encode($data), $pdfPro->getApiKey()), $pdfPro->getApiKey(), $pdfPro->getVersion(), $type, $pdfPro->getHash(), Mage::getStoreConfig('web/unsecure/base_url'))));
     $result['content'] = $pdfPro->decode($result['content'], $pdfPro->getApiKey());
     $client->call('endSession', array($session));
     $result = new Varien_Object($result);
     Mage::dispatchEvent('ves_pdfpro_pdf_prepare', array('type' => $type, 'result' => $result, 'communication' => 'xmlrpc'));
     return $result->getData();
 }
예제 #4
0
 /**
  * Execute test client WS request
  * @param string $serverurl
  * @param string $function
  * @param array $params
  * @return mixed
  */
 public function simpletest($serverurl, $function, $params)
 {
     //zend expects 0 based array with numeric indexes
     $params = array_values($params);
     require_once 'Zend/XmlRpc/Client.php';
     $client = new Zend_XmlRpc_Client($serverurl);
     return $client->call($function, $params);
 }
예제 #5
0
파일: lib.php 프로젝트: rboyatt/mahara
 /**
  * Execute client WS request
  * @param string $functionname
  * @param array $params
  * @return mixed
  */
 public function call($functionname, $params)
 {
     //zend expects 0 based array with numeric indexes
     $params = array_values($params);
     //traditional Zend soap client call (integrating the token into the URL)
     $result = parent::call($functionname, $params);
     return $result;
 }
 /**
  * post articles to wordpress
  * @params 
  * @return void
  * @author cnxzcxy<*****@*****.**>
  **/
 private function _rpc($title, $content, $tag, $site)
 {
     $client = new Zend_XmlRpc_Client('http://your.wordpress.com/xmlrpc.php');
     try {
         $res = $client->call('metaWeblog.newPost', array(0, 'admin', 'admin', array('title' => rawurldecode($title), 'description' => $content, 'mt_keywords' => $tag), true));
     } catch (Exception $e) {
         print_r($e);
     }
 }
    public function postAction()
    {
        if ($this->getRequest()->isPost()) {
            $request = Mage::getModel('catalogrequest/catalogrequest');
            $data = $this->getRequest()->getPost();
            $data['time_added'] = now();
            $data['country'] = $data['country_id'];
            $data['ip'] = $_SERVER['REMOTE_ADDR'];
            $data['fname'] = ucwords($data['fname']);
            $data['lname'] = ucwords($data['lname']);
            $data['address1'] = ucwords(str_replace(",", " ", $data['address1']));
            $data['address2'] = ucwords(str_replace(",", " ", $data['address2']));
            $data['city'] = ucwords($data['city']);
            if (empty($data['region'])) {
                $data['state'] = Mage::getModel('directory/region')->load($data['state'])->getCode();
            } else {
                $data['state'] = $data['region'];
            }
            // Validate
            if (!($errors = $request->validate($data))) {
                MAGE::getSingleton('core/session')->addError($errors);
            }
            /**
             *  Mail Chimp Integration
             *  If updates requested add to Mailchimp
             *  Change the MC_LIST_ID at the top to match your MC list id found in your list settings on MailChimp
             */
            if (isset($data['updates']) && isset($data['email'])) {
                $apikey = Mage::getStoreConfig('mailchimp/general/apikey');
                // Get API key from MC Module
                $merge_vars = array('INTERESTS' => Mage::getStoreConfig('mailchimp/subscribe/interests'));
                // Get Interests from MC Module
                try {
                    // You may need to change this URL, consult the MC API
                    $client = new Zend_XmlRpc_Client('http://us1.api.mailchimp.com/1.2/');
                    $response = $client->call('listSubscribe', array($apikey, self::MC_LIST_ID, $data['email'], $merge_vars, 'HTML', FALSE));
                } catch (Exception $e) {
                    Mage::getSingleton('adminhtml/session')->addError('Mailchimp failed to connect');
                }
            }
            // Add to database
            try {
                $request->setData($data)->save();
                MAGE::getSingleton('core/session')->addSuccess($this->__('<h2>Thank you</h3> You can expect to receive your catalog in 10-14 days.<br> You probably have some friends that would enjoy receiving the Aerostich catalog, go ahead and send them one too. '));
                $this->_redirect('*/*/');
                return;
                die;
            } catch (Exception $e) {
                MAGE::getSingleton('core/session')->addError('Sorry, we\'ve had some trouble saving your request, please call and request a catalog 
(800-222-2222) or email (service@example.com) to request a catalog');
                $this->_redirect('*/*/');
                return;
            }
        }
        return;
    }
예제 #8
0
 /**
  * send SMS
  *
  * @param string $_caller
  * @param string $_callee
  * @param string $_content
  */
 public function sendSms($_caller, $_callee, $_content)
 {
     $_callee = preg_replace('/\\+/', '', $_callee);
     $structAr['LocalUri'] = new Zend_XmlRpc_Value_String('sip:' . $_caller . '@sipgate.net');
     $structAr['RemoteUri'] = new Zend_XmlRpc_Value_String('sip:' . $_callee . '@sipgate.net');
     $structAr['TOS'] = new Zend_XmlRpc_Value_String('text');
     $structAr['Content'] = new Zend_XmlRpc_Value_String($_content);
     $struct = new Zend_XmlRpc_Value_Struct($structAr);
     return $this->_rpc->call('samurai.SessionInitiate', array(0 => $struct));
 }
예제 #9
0
 /**
  * @group ZF-1897
  */
 public function testHandlesLeadingOrTrailingWhitespaceInChunkedResponseProperly()
 {
     $baseUri = "http://foo:80";
     $this->httpAdapter = new Adapter\Test();
     $this->httpClient = new Http\Client(null, array('adapter' => $this->httpAdapter));
     $respBody = file_get_contents(dirname(__FILE__) . "/_files/ZF1897-response-chunked.txt");
     $this->httpAdapter->setResponse($respBody);
     $this->xmlrpcClient = new Client($baseUri);
     $this->xmlrpcClient->setHttpClient($this->httpClient);
     $this->assertEquals('FOO', $this->xmlrpcClient->call('foo'));
 }
 /**
  * @group ZF-8580
  */
 public function testCallSelectsCorrectSignatureIfMoreThanOneIsAvailable()
 {
     $this->mockIntrospector();
     $this->mockedIntrospector->expects($this->exactly(2))->method('getMethodSignature')->with('get')->will($this->returnValue(array(array('parameters' => array('int')), array('parameters' => array('array')))));
     $expectedResult = 'array';
     $this->setServerResponseTo($expectedResult);
     $this->assertSame($expectedResult, $this->xmlrpcClient->call('get', array(array(1))));
     $expectedResult = 'integer';
     $this->setServerResponseTo($expectedResult);
     $this->assertSame($expectedResult, $this->xmlrpcClient->call('get', array(1)));
 }
예제 #11
0
 /**
  * @group ZF-3288
  */
 public function testCustomHttpClientUserAgentIsNotOverridden()
 {
     $this->assertNull($this->httpClient->getHeader('user-agent'), 'UA is null if no request was made');
     $this->setServerResponseTo(true);
     $this->assertTrue($this->xmlrpcClient->call('method'));
     $this->assertSame('Zend_XmlRpc_Client', $this->httpClient->getHeader('user-agent'), 'If no custom UA is set, set Zend_XmlRpc_Client');
     $expectedUserAgent = 'Zend_XmlRpc_Client (custom)';
     $this->httpClient->setHeaders(array('user-agent' => $expectedUserAgent));
     $this->setServerResponseTo(true);
     $this->assertTrue($this->xmlrpcClient->call('method'));
     $this->assertSame($expectedUserAgent, $this->httpClient->getHeader('user-agent'));
 }
예제 #12
0
 public function toOptionArray()
 {
     $store = null;
     if (Mage::app()->getRequest()->getParam('store')) {
         $store = Mage::app()->getRequest()->getParam('store');
     } else {
         if (Mage::app()->getRequest()->getParam('website')) {
             $store = Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultStore()->getId();
         }
     }
     if (!Mage::getStoreConfig('advancednewsletter/mailchimpconfig/mailchimpenabled', $store)) {
         return array();
     }
     $xmlrpcurl = Mage::getStoreConfig('advancednewsletter/mailchimpconfig/xmlrpc', $store);
     $apikey = Mage::getStoreConfig('advancednewsletter/mailchimpconfig/apikey', $store);
     if (!$apikey || !$xmlrpcurl) {
         return array();
     }
     $lists = array();
     try {
         $arr = explode('-', $apikey, 2);
         $dc = isset($arr[1]) ? $arr[1] : 'us1';
         list($aux, $host) = explode('http://', $xmlrpcurl);
         $api_host = 'http://' . $dc . '.' . $host;
         $client = new Zend_XmlRpc_Client($api_host);
         /*
          *   Mailchimp API 1.3
          *   lists(string apikey, [array filters], [int start], [int limit])
          *   
          */
         $lists = $client->call('lists', $apikey);
     } catch (Exception $e) {
         /*
          * #test connection button is responsible now for connection check
          */
         return array();
     }
     if (is_array($lists) && isset($lists['data']) && count($lists['data'])) {
         $options = array();
         $options[] = array('label' => 'Select a list..', 'value' => '');
         foreach ($lists['data'] as $list) {
             $options[] = array('value' => $list['id'], 'label' => $list['name']);
         }
         return $options;
     }
     return array();
 }
예제 #13
0
 private function affiliate_call($method, $params)
 {
     array_unshift($params, $this->secret);
     try {
         $client = new Zend_XmlRpc_Client("{$this->url}/xmlrpc-cart.php");
         return $client->call($method, $params);
     } catch (Zend_XmlRpc_Client_HttpException $e) {
         Mage::log('AfA xmlrpc: (code ' . $e->getCode() . ') ' . $e->getMessage(), Zend_Log::WARN);
         return FALSE;
     } catch (Zend_XmlRpc_Client_FaultException $e) {
         Mage::log('AfA xmlrpc: (code ' . $e->getCode() . ') ' . $e->getMessage(), Zend_Log::WARN);
         return FALSE;
     } catch (Exception $e) {
         Mage::log('AfA xmlrpc: ' . $e->getMessage(), Zend_Log::WARN);
         return FALSE;
     }
 }
 public function indexAction()
 {
     $client = new Zend_XmlRpc_Client('http://localhost/xmlrpc-test/public/server');
     try {
         //$data = $client->call('cf.test');
         $data = $client->call('cf.getData', 200);
         $this->view->data = $data;
         $httpClient = $client->getHttpClient();
         $response = $httpClient->getLastResponse();
         echo strlen($response->getRawBody()) / 1024;
     } catch (Zend_XmlRpc_Client_HttpException $e) {
         require_once 'Zend/Exception.php';
         throw new Zend_Exception($e);
     } catch (Zend_XmlRpc_Client_FaultException $e) {
         require_once 'Zend/Exception.php';
         throw new Zend_Exception($e);
     }
 }
예제 #15
0
 public function toOptionArray()
 {
     $store = null;
     if (Mage::app()->getRequest()->getParam('store')) {
         $store = Mage::app()->getRequest()->getParam('store');
     } else {
         if (Mage::app()->getRequest()->getParam('website')) {
             $store = Mage::app()->getWebsite(Mage::app()->getRequest()->getParam('website'))->getDefaultStore()->getId();
         }
     }
     $xmlrpcurl = Mage::getStoreConfig('advancednewsletter/mailchimpconfig/xmlrpc', $store);
     $apikey = Mage::getStoreConfig('advancednewsletter/mailchimpconfig/apikey', $store);
     if (!$apikey || !$xmlrpcurl) {
         return array();
     }
     if (substr($apikey, -4) != '-us1' && substr($apikey, -4) != '-us2') {
         Mage::getSingleton('adminhtml/session')->addError('The API key is not well formed');
         return '';
     }
     try {
         list($key, $dc) = explode('-', $apikey, 2);
         if (!$dc) {
             $dc = 'us1';
         }
         list($aux, $host) = explode('http://', $xmlrpcurl);
         $api_host = 'http://' . $dc . '.' . $host;
         $client = new Zend_XmlRpc_Client($api_host);
         $lists = '';
         $lists = $client->call('lists', $apikey);
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
     }
     if (!is_array($lists)) {
         return '';
     }
     $options = array('label' => 'Select a list..');
     foreach ($lists as $list) {
         $options[] = array('value' => $list['id'], 'label' => $list['name']);
     }
     return $options;
 }
예제 #16
0
/**
 * Get remote calendar events
 * @param int $tstart Start time of time range for events
 * @param int $tend   End time of time range for events
 * @param array/int/boolean $users array of users, user id or boolean for all/no user events
 * @param array/int/boolean $groups array of groups, group id or boolean for all/no group events
 * @param array/int/boolean $courses array of courses, course id or boolean for all/no course events
 *
 * @return array of selected remote events + local events or return the events passed to this function (local)
 */
function get_remote_events($tstart, $tend, $users, $event_index)
{
    global $DB, $USER, $CFG, $SESSION;
    $events = array();
    if (is_string($users) || is_int($users)) {
        // get instances
        require_once $CFG->dirroot . '/local/eclass/lib/session_storage.php';
        $instances = eclass_getUserInstances($USER->username);
        foreach ($instances as $instance) {
            $serverurl = $instance->url . "/webservice/xmlrpc/server.php" . '?wstoken=' . $instance->token;
            require_once 'Zend/XmlRpc/Client.php';
            $xmlrpcclient = new Zend_XmlRpc_Client($serverurl);
            //make the web service call
            $function = 'eclass_get_events';
            $params = array('userid' => $USER->username, 'start' => $tstart, 'end' => $tend, 'cal_global' => (int) $SESSION->cal_show_global, 'cal_groups' => (int) $SESSION->cal_show_groups, 'cal_course' => (int) $SESSION->cal_show_course, 'cal_user' => (int) $SESSION->cal_show_user);
            try {
                $remote_events = $xmlrpcclient->call($function, $params);
                foreach ($remote_events as $anevent) {
                    $anevent = (object) $anevent;
                    $events[$event_index] = $anevent;
                    $events[$event_index]->id = $event_index;
                    $event_index++;
                }
            } catch (Exception $e) {
                var_dump($e);
            }
        }
    }
    if (!empty($events)) {
        $event_cache = new StdClass();
        $event_cache->events = $events;
        $event_cache->s_time = $tstart;
        $event_cache->e_time = $tend;
        $eCache = new EclassCache();
        $eCache->setData("events" . $SESSION->cal_show_global . $SESSION->cal_show_groups . $SESSION->cal_show_course . $SESSION->cal_show_user, 5, $event_cache);
    }
    return $events;
}
예제 #17
0
function secpay_xmlrpc_call($call, $values)
{
    $client = new Zend_XmlRpc_Client('https://www.secpay.com/secxmlrpc/make_call');
    //echo "<pre>"; var_dump($values); echo "</pre>";
    try {
        $response = $client->call($call, $values);
    } catch (Zend_XmlRpc_Client_FaultException $e) {
        echo 'ERROR [' . $e->getCode() . ']:' . $e->getMessage();
    } catch (Zend_XmlRpc_Client_HttpException $e) {
        echo 'ERROR [' . $e->getCode() . ']:' . $e->getMessage();
    }
    // echo "<pre>"; var_dump($response); echo "</pre>";
    if ($response) {
        parse_str($response, $result);
        // Convert response query string to array
        return $result;
    } else {
        $result['?valid'] = false;
        $result['message'] = "no valid response from SECpay";
        $result['code'] = "no valid response from SECpay";
        return $result;
    }
}
#!/usr/local/bin/php
<?php 
// Enable Zend Autoloader
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('A2o_');
// Create client and
$client = new Zend_XmlRpc_Client('http://localhost:30000/');
// Which call and with what parameters
// Watch double array for parameters
$method = 'system.listMethods';
// Call and evaluate
try {
    $result = $client->call($method);
} catch (Zend_Exception $e) {
    echo "Error calling server method: " . $e->getMessage() . "\n";
    exit;
}
// Output result
print_r($result);
echo "\n";
 * GNU General Public License for more details:
 *
 *         http://www.gnu.org/copyleft/gpl.html
 *
 * @category  Moodle
 * @package   webservice
 * @copyright Copyright (c) 1999 onwards Martin Dougiamas     http://dougiamas.com
 * @license   http://www.gnu.org/copyleft/gpl.html     GNU GPL License
 */
/*
 * Zend XMLRPC sclient
 */
require_once '../../../config.php';
include "Zend/Loader.php";
Zend_Loader::registerAutoload();
//1. authentication
$client = new Zend_XmlRpc_Client($CFG->wwwroot . "/webservice/xmlrpc/server.php");
$token = $client->call('authentication.get_token', array(array('username' => "wsuser", 'password' => "wspassword")));
var_dump($token);
//2. test functions
$client = new Zend_XmlRpc_Client($CFG->wwwroot . "/webservice/xmlrpc/server.php?classpath=user&token=" . $token);
var_dump($users = $client->call('user.get_users', array(array('search' => "admin"))));
print "<br/><br/>\n";
var_dump($users = $client->call('user.create_users', array(array(array('firstname' => "firstname6", 'username' => "mockuser66", 'lastname' => "lastname6", 'email' => "*****@*****.**", 'password' => "password6")))));
print "<br/><br/>\n";
var_dump($users = $client->call('user.update_users', array(array(array('username' => "mockuser66", 'newusername' => "mockuser6b", 'firstname' => "firstname6b")))));
print "<br/><br/>\n";
var_dump($users = $client->call('user.delete_users', array(array(array('username' => "mockuser6b")))));
//print "<br/><br/>\n";
//var_dump($users = $client->call('user.tmp_do_multiple_user_searches', array(array(array('search' => "jerome"),array('search' => "admin")))));
//print "<br/><br/>\n";
예제 #20
0
파일: test.php 프로젝트: dreamsxin/Kellner
<?php

ini_set('include_path', ini_get('include_path') . ':../library');
require_once 'Zend/XmlRpc/Client.php';
require_once 'Zend/Http/Client.php';
require_once 'Zend/Json.php';
echo "Requesting through XML-RPC...\n";
$client = new Zend_XmlRpc_Client('http://127.0.0.1:8080/xmlrpc');
$result = $client->call('poll.getAllPolls');
print_r($result);
echo "Requesting though JSON-RPC...\n";
$json = '{"method":"poll.getAllPolls","params": []}';
$client = new Zend_Http_Client("http://127.0.0.1:8080/jsonrpc");
$client->setRawData($json);
$response = $client->request("POST");
print_r(Zend_Json::decode($response->getBody()));
예제 #21
0
파일: rpc.php 프로젝트: Tony133/zf-web
<?php

error_reporting(E_ALL & ~E_WARNING);
ini_set('display_errors', true);
require_once 'Zend/XmlRpc/Client.php';
$xmlRpc = new Zend_XmlRpc_Client('http://localhost/test/service.php');
echo $xmlRpc->call('getPhpInfo');
예제 #22
0
 public static function testConnection($params)
 {
     $helper = Mage::helper('advancednewsletter');
     if (!isset($params['apikey'])) {
         throw new AW_Advancednewsletter_Exception($helper->__('Invalid Request. Api key info not found'));
     }
     if (!isset($params['xmlrpc'])) {
         throw new AW_Advancednewsletter_Exception($helper->__('Invalid Request. Xmlrpc info not found'));
     }
     $instance = new self();
     $instance->_keysValues[self::MAILCHIMP_APIKEY] = trim($params['apikey']);
     $instance->_keysValues[self::MAILCHIMP_XMLRPC] = trim($params['xmlrpc']);
     try {
         $client = new Zend_XmlRpc_Client($instance->_connect());
         $client->getHttpClient()->setConfig(array('timeout' => self::REQUEST_TIMEOUT));
         $client->call('chimpChatter', array($instance->_keysValues[self::MAILCHIMP_APIKEY]));
     } catch (Exception $e) {
         throw new AW_Advancednewsletter_Exception($helper->__('Cannot connect to MailChimp'));
     }
 }
#!/usr/local/bin/php
<?php 
// Enable Zend Autoloader
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('A2o_');
// Create client and
$client = new Zend_XmlRpc_Client('http://localhost:30000/');
// Which call and with what parameters
// Watch double array for parameters
$method = 'ns1.doSomething';
$params = array('string', 1234);
// Call and evaluate
try {
    $result = $client->call($method, $params);
} catch (Zend_Exception $e) {
    echo "Error calling server method: " . $e->getMessage() . "\n";
    exit;
}
// Output result
print_r($result);
echo "\n";
예제 #24
0
 /**
  * Get version of PDF Pro from Server
  */
 public function getMessage()
 {
     if (class_exists('SoapClient')) {
         $client = new PdfProSoapClient($this->decode(self::PDF_PRO_WSDL, '5e6bf967aab429405f5855145e6e0fa7'));
         $client->__setTimeout(1200);
         $session = $client->login($this->decode(self::PDF_PRO_API_USERNAME, '5e6bf967aab429405f5855145e6e0fa7'), $this->decode(self::PDF_PRO_API_PASSWORD, '5e6bf967aab429405f5855145e6e0fa7'));
         $result = $client->call($session, 'pdfpro.getMessage', array());
         $client->endSession($session);
     } else {
         if (class_exists('Zend_XmlRpc_Client')) {
             $client = new Zend_XmlRpc_Client($this->decode(self::PDF_PRO_XMLRPC, '5e6bf967aab429405f5855145e6e0fa7'));
             $client->getHttpClient()->setConfig(array('timeout' => 1200));
             $session = $client->call('login', array($this->decode(self::PDF_PRO_API_USERNAME, '5e6bf967aab429405f5855145e6e0fa7'), $this->decode(self::PDF_PRO_API_PASSWORD, '5e6bf967aab429405f5855145e6e0fa7')));
             $result = $client->call('call', array($session, 'pdfpro.getMessage', array()));
             $client->call('endSession', array($session));
         } else {
             $result = array('success' => false, 'msg' => "Your website does not support for PDF Pro");
         }
     }
     return $result;
 }
예제 #25
0
파일: xmlrpc.php 프로젝트: vberzsin/shop
<?php

require_once "mygassi-config.php";
require_once mageroot;
$client = new Zend_XmlRpc_Client('https://shop.mygassi.com/api/xmlrpc');
$session = $client->call('login', array('Schnuggywuggy', '2317.schnuggy'));
$result = $client->call('call', array($session, 'catalog_product.list'));
print_r($result);
exit(1);
예제 #26
0
파일: VConference.php 프로젝트: romlg/cms36
 /**
  * Получении ссылки iframe для просмотра
  */
 function getFileMovie($conferenceId, $userId, $fileIndex)
 {
     $userId = $userId ? $userId : 0;
     $fileIndex = $fileIndex ? $fileIndex : 0;
     $client = new Zend_XmlRpc_Client($this->_serverName);
     $e = null;
     $errors = array();
     try {
         $res = $client->call('conference.getFileMovieLink', array($this->_apiKey, $conferenceId, $userId, $fileIndex));
     } catch (Exception $e) {
         $code = $e->getCode();
         $errors = array('error_code' => $code, 'error_text' => iconv('utf-8', 'windows-1251', $e->getMessage()));
     }
     return $res ? $res : $errors;
 }
예제 #27
0
파일: local4.php 프로젝트: pelif/studyWS
<?php

$value = $_POST['value'];
$value = (double) str_replace(',', '.', $value);
$from = $_POST['from'];
$to = $_POST['to'];
require 'startzend.php';
$client = new Zend_XmlRpc_Client('http://localhost/xmlgenerator/remote4.php');
$value2 = $client->call('converterMoeda', array($value, $from, $to));
/*
$proxy = $client->getProxy();
$value2 = $proxy->converterMoeda($value, $from, $to);
*/
//formatação
$value2 = str_replace('.', ',', $value2);
$currency1 = $client->call('descricaoMoeda', array($from));
$currency2 = $client->call('descricaoMoeda', array($to));
$mensagem = "{$value} {$currency1} equivalem a {$value2} {$currency2}";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Moeda convertida</title>
</head>
<body>
<?php 
echo $mensagem;
?>
<br>
<a href="form-conversao-moeda.php">Retornar</a>
예제 #28
0
 public function getLicenseInfo($licensekey, $extensionName, $domain)
 {
     $licensekey = trim($licensekey);
     // check license for old license key
     if ($oldLicenseInfo = $this->_decrypt($licensekey)) {
         $license = Mage::getModel('magenotification/license')->loadByLicenseExtension($licensekey, $extensionName);
         if (!$license->getId()) {
             // Request first time when using old license key
             try {
                 $xmlRpc = new Zend_XmlRpc_Client(self::SERVER_URL . 'api/xmlrpc/');
                 $session = $xmlRpc->call('login', array('username' => self::WEBSERVICE_USER, 'password' => self::WEBSERVICE_PASS));
                 $result = $xmlRpc->call('call', array('sessionId' => $session, 'apiPath' => 'licensemanager.active', 'args' => array($licensekey, $extensionName, $domain)));
                 $dataObject = new Varien_Object($result);
             } catch (Exception $e) {
                 return new Varien_Object(array('response_code' => 101));
             }
             $license->setResponseCode($dataObject->getResponseCode())->setDomains($dataObject->getDomains());
             if ($dataObject->getActivatedTime()) {
                 $license->setActiveAt(substr($dataObject->getActivatedTime(), 0, 10));
             } else {
                 $license->setActiveAt(now(true));
             }
             try {
                 $license->setSumCode($this->_getSumCode($license));
                 $license->save();
             } catch (Exception $e) {
             }
             return $dataObject;
         }
         $result = new Varien_Object($license->getData());
         $result->addData(array('users' => 1, 'created_time' => date('Y-m-d H:m:s', $oldLicenseInfo['created_time']), 'activated_time' => $license->getActiveAt(), 'type' => $oldLicenseInfo['type'], 'status' => 1, 'expired_time' => $oldLicenseInfo['expired_time']));
         if ($license->getSumCode() != $this->_getSumCode($license)) {
             try {
                 $license->setResponseCode(self::GENERAL_ERROR);
                 $license->setSumCode($this->_getSumCode($license))->save();
             } catch (Exception $e) {
             }
         } elseif ($result->getType() == self::TRIAL_VERSION && $license->getResponseCode() > self::LIMITED_DOMAIN_ERROR) {
             $expiredTime = strtotime($license->getActiveAt()) + (int) $result->getExpiredTime() * 24 * 3600;
             if ($expiredTime < time()) {
                 try {
                     $license->setResponseCode(self::EXPIRED_TRIAL_LICENSE_KEY_ERROR);
                     $license->setSumCode($this->_getSumCode($license))->save();
                 } catch (Exception $e) {
                 }
             }
         }
         return $result->setResponseCode($license->getResponseCode());
     }
     // check new license key
     if ($licenseInfo = $this->_newkeyDecrypt($licensekey, $extensionName, $domain)) {
         $license = Mage::getModel('magenotification/license')->loadByLicenseExtension($licensekey, $extensionName);
         if (!$license->getId()) {
             $license->setActiveAt(now(true))->setDomains($licenseInfo->getDomains());
             $responseCode = self::NEW_DOMAIN_SUCCESS;
             $licenseDomain = strlen($domain) > 38 ? substr($domain, 0, 38) : $domain;
             if ($licenseDomain != $licenseInfo->getDomains()) {
                 $responseCode = self::LIMITED_DOMAIN_ERROR;
             }
             try {
                 $license->setResponseCode($responseCode);
                 $license->setSumCode($this->_getSumCode($license))->save();
             } catch (Exception $e) {
             }
         }
         $result = new Varien_Object($license->getData());
         $createdTime = $licenseInfo->getCreatedDate() ? $licenseInfo->getCreatedDate() : $license->getActiveAt();
         $result->addData(array('users' => 1, 'created_time' => date('Y-m-d H:m:s', strtotime($createdTime)), 'activated_time' => $license->getActiveAt(), 'type' => $this->getOldLicenseType($licenseInfo->getType()), 'status' => 1, 'expired_time' => $licenseInfo->getExpiredTime()));
         if ($license->getSumCode() != $this->_getSumCode($license)) {
             try {
                 $license->setResponseCode(self::GENERAL_ERROR);
                 $license->setSumCode($this->_getSumCode($license))->save();
             } catch (Exception $e) {
             }
         } elseif (($result->getType() == self::TRIAL_VERSION || $result->getType() == self::DEVELOPMENT) && $license->getResponseCode() > self::LIMITED_DOMAIN_ERROR) {
             $expiredTime = strtotime($license->getActiveAt()) + (int) $result->getExpiredTime() * 24 * 3600;
             if ($expiredTime < time()) {
                 try {
                     $license->setResponseCode(self::EXPIRED_TRIAL_LICENSE_KEY_ERROR);
                     $license->setSumCode($this->_getSumCode($license))->save();
                 } catch (Exception $e) {
                 }
             }
         }
         return $result->setResponseCode($license->getResponseCode());
     }
     return new Varien_Object(array('response_code' => self::GENERAL_ERROR));
 }
 /**
  * Call a method in this namespace.
  *
  * @param  string $methodN
  * @param  array $args
  * @return mixed
  */
 public function __call($method, $args)
 {
     $method = ltrim("{$this->_namespace}.{$method}", '.');
     return $this->_client->call($method, $args);
 }
예제 #30
0
 protected function _rpc_Zend($url, $params)
 {
     @(include_once "Zend/XmlRpc/Client.php");
     $client = new Zend_XmlRpc_Client($url);
     try {
         $ret = $client->call($this->method_namespace . "." . $this->method_name, $params);
     } catch (Exception $e) {
         throw new Newsman_Client_Exception($e->getMessage());
     }
     return $ret;
 }