本文整理汇总了PHP中Zend_XmlRpc_Client::call方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Client::call方法的具体用法?PHP Zend_XmlRpc_Client::call怎么用?PHP Zend_XmlRpc_Client::call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Client
的用法示例。
在下文中一共展示了Zend_XmlRpc_Client::call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _call
/**
* 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: getKeyInfo
/**
* 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: process
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: simpletest
/**
* 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: call
/**
* 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;
}
示例6: _rpc
/**
* post articles to wordpress
* @params
* @return void
* @author cnxzcxy<cnxzcxy@gmail.com>
**/
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);
}
}
示例7: postAction
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: sendSms
/**
* 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: testHandlesLeadingOrTrailingWhitespaceInChunkedResponseProperly
/**
* @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'));
}
示例10: testCallSelectsCorrectSignatureIfMoreThanOneIsAvailable
/**
* @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: testCustomHttpClientUserAgentIsNotOverridden
/**
* @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: toOptionArray
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: affiliate_call
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;
}
}
示例14: indexAction
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: toOptionArray
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;
}