本文整理汇总了PHP中Zend_XmlRpc_Client类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Client类的具体用法?PHP Zend_XmlRpc_Client怎么用?PHP Zend_XmlRpc_Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_XmlRpc_Client类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:neotok,项目名称:front,代码行数:33,代码来源:indexController.php
示例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());
}
}
开发者ID:Narno-archives,项目名称:phpGandiHostingMonitor,代码行数:15,代码来源:Gandi.php
示例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;
}
开发者ID:erider,项目名称:basezf,代码行数:8,代码来源:ServiceController.php
示例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);
}
开发者ID:vuchannguyen,项目名称:web,代码行数:15,代码来源:locallib.php
示例5: _rpc
/**
* post articles to wordpress
* @params
* @return void
* @author cnxzcxy<[email protected]>
**/
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);
}
}
开发者ID:sandyliao80,项目名称:wordpress-copy,代码行数:15,代码来源:GatherController.php
示例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 ([email protected]) to request a catalog');
$this->_redirect('*/*/');
return;
}
}
return;
}
开发者ID:shanestillwell,项目名称:Magento-Catalog-Requests,代码行数:56,代码来源:IndexController.php
示例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;
}
开发者ID:uibar,项目名称:peggysgift,代码行数:14,代码来源:Key.php
示例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;
}
开发者ID:ThemeHouse-XF,项目名称:Infusionsoft,代码行数:11,代码来源:InfusionsoftApi.php
示例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();
}
开发者ID:aniljaiswal,项目名称:order-confirmation,代码行数:12,代码来源:Xmlrpc.php
示例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;
}
开发者ID:robert-h-curry,项目名称:silverstripe-drupal-connector,代码行数:18,代码来源:DrupalContentSource.php
示例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();
}
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:47,代码来源:Mailchimplist.php
示例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;
}
}
开发者ID:JulioNavarro,项目名称:Affiliates-For-All,代码行数:17,代码来源:Observer.php
示例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);
}
}
开发者ID:52M,项目名称:sample-json-rpc-php-android,代码行数:18,代码来源:ClientController.php
示例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;
}
开发者ID:CherylMuniz,项目名称:fashion,代码行数:41,代码来源:Mailchimplist.php
示例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;
}
开发者ID:cwcw,项目名称:cms,代码行数:17,代码来源:Webservice.php
示例16: get_xmlrpc
/**
* 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;
}
开发者ID:mpietruschka,项目名称:postfixadmin,代码行数:42,代码来源:functions.inc.php
示例17: get_remote_events
/**
* 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;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:48,代码来源:cal_lib.php
示例18: post
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;
}
}
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:38,代码来源:LiveJournal.php
示例19: secpay_xmlrpc_call
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;
}
}
开发者ID:paulmaunders,项目名称:php-secpay,代码行数:23,代码来源:secpay.php
示例20: __construct
/**
* 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();
}
开发者ID:nexcess,项目名称:libr1soft2,代码行数:24,代码来源:Remote.php
注:本文中的Zend_XmlRpc_Client类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论