本文整理汇总了PHP中Zend_XmlRpc_Client类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Client类的具体用法?PHP Zend_XmlRpc_Client怎么用?PHP Zend_XmlRpc_Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_XmlRpc_Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmlrpcgetuserlistAction
/**
* 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;
}
示例2: _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());
}
}
示例3: xmlrpcConsoleAction
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;
}
示例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: _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);
}
}
示例6: 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;
}
示例7: 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;
}
示例8: _connect
protected function _connect()
{
$xenOptions = XenForo_Application::get('options');
$appName = $xenOptions->th_infusionsoftApi_appName;
if (!$appName) {
return false;
}
$client = new Zend_XmlRpc_Client('https://' . $appName . '.infusionsoft.com/api/xmlrpc');
$client->getHttpClient()->setConfig(array('sslcert' => XenForo_Application::getInstance()->getRootDir() . 'library/ThemeHouse/InfusionsoftApi/infusionsoft.pem'));
return $client;
}
示例9: 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();
}
示例10: getClient
/**
* @return Zend_XmlRpc_Client
*/
public function getClient()
{
if (!$this->client) {
$client = new Zend_XmlRpc_Client($this->getApiUrl());
$client->setSkipSystemLookup(true);
$this->client = SS_Cache::factory('drupal_menu', 'Class', array('cached_entity' => $client, 'lifetime' => $this->getCacheLifetime()));
/*
TODO: authenticate, to avoid hacking perms in Drupal.
$result = $this->client->call('user.login', array($this->Username, $this->Password));
$sessionName = $result['session_name'];
$sessid = $result['sessid'];
*/
}
return $this->client;
}
示例11: 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();
}
示例12: 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;
}
}
示例13: 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);
}
}
示例14: 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;
}
示例15: getWebserviceClient
/**
* Retrieve client object
*
* @return Zend_XmlRpc_Client
*/
public function getWebserviceClient()
{
if (is_null($this->_client)) {
if ($this->_options['so']) {
$this->_client = new Streamwide_Web_Webservice_Client($this->_options['serverUrl'], $this->getOptions());
} else {
$this->_client = new Zend_XmlRpc_Client($this->_options['serverUrl']);
$this->_client->setSkipSystemLookup(true);
}
}
return $this->_client;
}