本文整理汇总了PHP中xmlrpc_client::setSSLVerifyHost方法的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_client::setSSLVerifyHost方法的具体用法?PHP xmlrpc_client::setSSLVerifyHost怎么用?PHP xmlrpc_client::setSSLVerifyHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpc_client
的用法示例。
在下文中一共展示了xmlrpc_client::setSSLVerifyHost方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClientConnect
public function getClientConnect()
{
$client = new xmlrpc_client(self::$odoo_url . ":" . self::$odoo_port . "/xmlrpc/object");
$client->setSSLVerifyPeer(0);
$client->setSSLVerifyHost(0);
return $client;
}
示例2: forward_request
/**
* Forward an xmlrpc request to another server, and return to client the response received.
* @param xmlrpcmsg $m (see method docs below for a description of the expected parameters)
* @return xmlrpcresp
*/
function forward_request($m)
{
// create client
$timeout = 0;
$url = php_xmlrpc_decode($m->getParam(0));
$c = new xmlrpc_client($url);
if ($m->getNumParams() > 3) {
// we have to set some options onto the client.
// Note that if we do not untaint the received values, warnings might be generated...
$options = php_xmlrpc_decode($m->getParam(3));
foreach ($options as $key => $val) {
switch ($key) {
case 'Cookie':
break;
case 'Credentials':
break;
case 'RequestCompression':
$c->setRequestCompression($val);
break;
case 'SSLVerifyHost':
$c->setSSLVerifyHost($val);
break;
case 'SSLVerifyPeer':
$c->setSSLVerifyPeer($val);
break;
case 'Timeout':
$timeout = (int) $val;
break;
}
// switch
}
}
// build call for remote server
/// @todo find a weay to forward client info (such as IP) to server, either
/// - as xml comments in the payload, or
/// - using std http header conventions, such as X-forwarded-for...
$method = php_xmlrpc_decode($m->getParam(1));
$pars = $m->getParam(2);
$m = new xmlrpcmsg($method);
for ($i = 0; $i < $pars->arraySize(); $i++) {
$m->addParam($pars->arraymem($i));
}
// add debug info into response we give back to caller
xmlrpc_debugmsg("Sending to server {$url} the payload: " . $m->serialize());
return $c->send($m, $timeout);
}
示例3: xmlrpcmsg
}
$f = new xmlrpcmsg("SECVPN.validateCardFull");
$f->addParam(new xmlrpcval($_REQUEST['merchantid'], "string"));
$f->addParam(new xmlrpcval($_REQUEST['vpnpassword'], "string"));
$f->addParam(new xmlrpcval($_REQUEST['invoiceid'], "string"));
$f->addParam(new xmlrpcval($_REQUEST['ipaddress'], "string"));
$f->addParam(new xmlrpcval($_REQUEST['name'], "string"));
$f->addParam(new xmlrpcval($_REQUEST['cardnum'], "string"));
$f->addParam(new xmlrpcval($_REQUEST['amount'], "string"));
$f->addParam(new xmlrpcval("/" . substr($_REQUEST['cardexp'], 2, 2), "string"));
$f->addParam(new xmlrpcval($_REQUEST['issuenum'], "string"));
$f->addParam(new xmlrpcval("/" . substr($_REQUEST['startdate'], 2, 2), "string"));
$f->addParam(new xmlrpcval("", "string"));
$f->addParam(new xmlrpcval("", "string"));
$f->addParam(new xmlrpcval("name=" . $_REQUEST['clientdetailsfirstname'] . " " . $_REQUEST['clientdetailslastname'] . ",company=" . $_REQUEST['clientdetailscompanyname'] . ",addr_1=" . $_REQUEST['clientdetailsaddress1'] . ",addr_2=" . $_REQUEST['clientdetailsaddress2'] . ",city=" . $_REQUEST['clientdetailscity'] . ",state=" . $_REQUEST['clientdetailstate'] . ",post_code=" . $_REQUEST['clientdetailspostcode'] . ",tel=" . $_REQUEST['clientdetailsphonenumber'] . ",email=" . $_REQUEST['clientdetailsemail'] . "", "string"));
$f->addParam(new xmlrpcval($repeattrans . ("test_status=" . $testmode . ",dups=false,currency=") . $_REQUEST['currencycode'] . ",cv2=" . $_REQUEST['cardcvv'], "string"));
$c = new xmlrpc_client("/secxmlrpc/make_call", "www.secpay.com", 443);
$c->setSSLVerifyHost(0);
$c->setSSLVerifyPeer(0);
$r = $c->send($f, 20, "https");
$v = $r->value();
$faultcode = $r->faultCode();
$faultreason = $r->faultString();
if ($faultcode) {
echo "?FaultCode=" . $faultcode . "&FaultReason=" . $faultreason;
return 1;
}
$result = $v->scalarval();
$result2 = htmlentities($r->serialize());
echo $result;
}
示例4: uploadrpc
/**
* Upload a data record from the given fid to the RPC server
* Currently will work with queXS 1.5.2
*
* @param int $fid The formid to upload
*
* @return
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2011-11-04
*/
function uploadrpc($fid)
{
global $db;
//get url, qid
$sql = "SELECT q.rpc_server_url,q.rpc_username,q.rpc_password,f.qid,q.limesurvey_sid\n\t\tFROM forms as f, questionnaires as q\n\t\tWHERE f.fid = '{$fid}'\n\t\tAND f.qid = q.qid";
$rs = $db->GetRow($sql);
if (!empty($rs['rpc_server_url'])) {
$url = $rs['rpc_server_url'];
$qid = $rs['qid'];
$surveyid = $rs['limesurvey_sid'];
include_once dirname(__FILE__) . "/../include/xmlrpc-3.0.0.beta/lib/xmlrpc.inc";
list($head, $data) = outputdatacsv($qid, $fid, false, false, true);
$assoc = array();
for ($i = 0; $i < count($head); $i++) {
//concat if same variable name
if (isset($assoc[$head[$i]])) {
$assoc[$head[$i]] .= $data[$i];
} else {
$assoc[$head[$i]] = $data[$i];
}
}
//formid not recognised by limesurvey
unset($assoc['formid']);
unset($assoc['rpc_id']);
//make sure token won't interfere with normal operation of questionnaire
$assoc['token'] = "queXF-" . $fid;
$xmlrpc_val = php_xmlrpc_encode($assoc);
$client = new xmlrpc_client($url);
$client->setSSLVerifyHost(0);
//$client->setDebug(2);
$cred = array(new xmlrpcval($rs['rpc_username']), new xmlrpcval($rs['rpc_password']));
//First need to connect and get session key
$message = new xmlrpcmsg("get_session_key", $cred);
$resp = $client->send($message);
if ($resp->faultCode()) {
echo T_("XML RPC Error: ") . $resp->faultString();
} else {
$sessionkey = $resp->value();
$message = new xmlrpcmsg("add_response", array($sessionkey, new xmlrpcval($surveyid, "int"), $xmlrpc_val));
$resp = $client->send($message);
if ($resp->faultCode()) {
echo T_("XML RPC Error (functions.output.php): ") . $resp->faultString();
} else {
//echo 'OK: got '.php_xmlrpc_decode($resp->value());
//update forms table with rpc_id
$sql = "UPDATE forms\n\t\t\t\t\tSET rpc_id = '" . php_xmlrpc_decode($resp->value()) . "'\n\t\t\t\t\tWHERE fid = '{$fid}'";
$db->Execute($sql);
}
}
}
}
示例5: xmlrpc_wrapper
/**
* @param $host
* @param $msg
* @return xmlrpcresp
*/
function xmlrpc_wrapper($host, $msg)
{
$method = 'http';
// Work out port
if (defined('SSL_ONLY') && SSL_ONLY) {
$port = 443;
$method = 'https';
} elseif (defined('RPC_PORT')) {
$port = RPC_PORT;
if (defined('RPC_SSL') && RPC_SSL) {
$method = 'https';
if (!defined('RPC_PORT')) {
$port = 443;
}
}
} else {
$port = 80;
}
$client = new xmlrpc_client(constant('RPC_RELATIVE_PATH') . '/rpcserver.php', $host, $port);
if (DEBUG) {
$client->setDebug(1);
}
$client->setSSLVerifyPeer(0);
$client->setSSLVerifyHost(0);
$response = $client->send($msg, 0, $method);
return $response;
}
示例6: InfusionSoft
//.........这里部分代码省略.........
$msg->addParam(new xmlrpcval(1, 'int'));
$msg->addParam(new xmlrpcval(0, 'int'));
$msg->addParam(new xmlrpcval(array('Id' => new xmlrpcval($SId, 'int')), 'struct'));
$msg->addParam(new xmlrpcval(array(new xmlrpcval('Id'), new xmlrpcval('ContactId'), new xmlrpcval('OriginatingOrderId'), new xmlrpcval('SubscriptionPlanId'), new xmlrpcval('ProductId'), new xmlrpcval('StartDate'), new xmlrpcval('EndDate'), new xmlrpcval('LastBillDate'), new xmlrpcval('NextBillDate'), new xmlrpcval('ReasonStopped'), new xmlrpcval('Status')), 'array'));
$recur = $con->send($msg);
$recur = $recur->value();
if ($recur) {
return $recur[0];
} else {
return false;
}
}
//function for getting subscription using jobid
function GetSubscriptionStatusByJID($contactID, $JId, $con, $key)
{
$msg = new xmlrpcmsg('DataService.query');
$msg->addParam(new xmlrpcval($key));
$msg->addParam(new xmlrpcval('RecurringOrder'));
$msg->addParam(new xmlrpcval(1, 'int'));
$msg->addParam(new xmlrpcval(0, 'int'));
$msg->addParam(new xmlrpcval(array('ContactId' => new xmlrpcval($contactID), 'OriginatingOrderId' => new xmlrpcval($JId, 'int')), 'struct'));
$msg->addParam(new xmlrpcval(array(new xmlrpcval('Id'), new xmlrpcval('ContactId'), new xmlrpcval('OriginatingOrderId'), new xmlrpcval('SubscriptionPlanId'), new xmlrpcval('ProductId'), new xmlrpcval('StartDate'), new xmlrpcval('EndDate'), new xmlrpcval('LastBillDate'), new xmlrpcval('NextBillDate'), new xmlrpcval('ReasonStopped'), new xmlrpcval('Status')), 'array'));
$recur = $con->send($msg);
$recur = $recur->value();
if ($recur) {
return $recur[0];
} else {
return false;
}
}
function getInvoiceRefunds($con, $key, $invid)
{
$con->return_type = 'phpvals';
$con->setSSLVerifyHost(0);
$con->setSSLVerifyPeer(0);
$msg = new xmlrpcmsg('DataService.query');
$msg->addParam(new xmlrpcval($key));
$msg->addParam(new xmlrpcval('InvoicePayment'));
$msg->addParam(new xmlrpcval(1000, 'int'));
$msg->addParam(new xmlrpcval(0, 'int'));
$msg->addParam(new xmlrpcval(array('InvoiceId' => new xmlrpcval($invid, 'int')), 'struct'));
$msg->addParam(new xmlrpcval(array(new xmlrpcval('Id'), new xmlrpcval('InvoiceId'), new xmlrpcval('Amt'), new xmlrpcval('PayStatus'), new xmlrpcval('PaymentId'), new xmlrpcval('SkipCommission')), 'array'));
$inv_payments = $con->send($msg);
$inv_payments = $inv_payments->value();
$refunded_amount = 0;
if ($inv_payments) {
foreach ($inv_payments as $inv_payment) {
if ($inv_payment['PayStatus'] == 'Refunded') {
$refunded_amount += abs($inv_payment['Amt']);
}
}
}
return $refunded_amount;
}
function isLastInvoicePaid($con, $key, $invoice)
{
//lets get the jobs for the subscription
$jobs = GetSubscriptionJobs($invoice['SubscriptionId'], $con, $key);
if (!$jobs) {
return false;
}
//no job then unpaid
$job_ids = array_map(create_function('$arr', 'return $arr["Id"];'), $jobs);
//we only need the ids
$latest_jobid = max($job_ids);
//get the latest invoice of this subscription
示例7: AutoResponderInfusionsoft
function AutoResponderInfusionsoft($that, $ar, $wpm_id, $email, $unsub = false)
{
global $WishListMemberInstance;
if (!class_exists('xmlrpcmsg') || !class_exists('xmlrpcval') || !class_exists('xmlrpc_client')) {
include_once $x = $WishListMemberInstance->pluginDir . '/extlib/xmlrpc.php';
}
$iskey = $ar['iskey'];
// get the Infusionsoft API
$ismname = $ar['ismname'];
// get the Infusionsoft API
$cID = $ar['isCID'][$wpm_id];
// get the campaign ID of the Membership Level
$isUnsub = $ar['isUnsub'][$wpm_id] == 1 ? true : false;
// check if we will unsubscribe or not
if ($cID) {
//$listID should not be empty
list($fName, $lName) = explode(" ", $that->ARSender['name'], 2);
//split the name into First and Last Name
$emailAddress = $that->ARSender['email'];
//create connection
$url = 'https://' . $ismname . '.infusionsoft.com:443/api/xmlrpc';
$con = new xmlrpc_client($url);
$con->return_type = 'phpvals';
$con->setSSLVerifyHost(0);
$con->setSSLVerifyPeer(0);
//check if the user is already in the database
$returnFields = array('Id');
$carray = array(php_xmlrpc_encode($iskey), php_xmlrpc_encode($emailAddress), php_xmlrpc_encode($returnFields));
$call = new xmlrpcmsg('ContactService.findByEmail', $carray);
$dups = $con->send($call);
if (!$dups->faultCode()) {
$dups = $dups->value();
$personId = $dups[0]['Id'];
}
if ($unsub) {
// if the Unsubscribe
//if email is found, remove it from campaign and if it will be unsubscribe once remove from level
if (!empty($personId) && $isUnsub) {
$msg = new xmlrpcmsg('ContactService.removeFromCampaign');
$msg->addParam(new xmlrpcval($iskey));
$msg->addParam(new xmlrpcval((int) $personId, 'int'));
$msg->addParam(new xmlrpcval((int) $cID, 'int'));
$res = $con->send($msg);
if (!$res->faultCode()) {
$res = $res->value();
}
}
} else {
//else Subscribe
//if email is existing, assign it to the campaign
if (!empty($personId)) {
$msg = new xmlrpcmsg('APIEmailService.optIn');
$msg->addParam(new xmlrpcval($iskey));
$msg->addParam(new xmlrpcval($emailAddress));
$msg->addParam(new xmlrpcval("WishList Member Autoresponde Integration Optin"));
$res = $con->send($msg);
$msg = new xmlrpcmsg('ContactService.addToCampaign');
$msg->addParam(new xmlrpcval($iskey));
$msg->addParam(new xmlrpcval((int) $personId, 'int'));
$msg->addParam(new xmlrpcval((int) $cID, 'int'));
$res = $con->send($msg);
if (!$res->faultCode()) {
$res = $res->value();
}
} else {
//if email is new, assign it to the add it to the database
$msg = new xmlrpcmsg('ContactService.add');
$msg->addParam(new xmlrpcval($iskey));
$msg->addParam(new xmlrpcval(array('Email' => new xmlrpcval($emailAddress), 'FirstName' => new xmlrpcval($fName), 'LastName' => new xmlrpcval($lName)), 'struct'));
$newId = $con->send($msg);
// if successfully addded, opt-in the contact
if (!$newId->faultCode()) {
$newId = $newId->value();
$msg = new xmlrpcmsg('APIEmailService.optIn');
$msg->addParam(new xmlrpcval($iskey));
$msg->addParam(new xmlrpcval($emailAddress));
$msg->addParam(new xmlrpcval("WishList Member Autoresponde Integration Optin"));
$res = $con->send($msg);
if (!$res->faultCode()) {
$res = $res->value();
}
//then assign it to the campaign
$msg = new xmlrpcmsg('ContactService.addToCampaign');
$msg->addParam(new xmlrpcval($iskey));
$msg->addParam(new xmlrpcval((int) $newId, 'int'));
$msg->addParam(new xmlrpcval((int) $cID, 'int'));
$res = $con->send($msg);
if (!$res->faultCode()) {
$res = $res->value();
}
}
}
}
}
}
示例8: init
/**
* Initializes the Klarna object accordingly to the set config object.
*
* @throws KlarnaException
* @return void
*/
protected function init()
{
$this->hasFields('eid', 'secret', 'mode', 'pcStorage', 'pcURI');
if (!is_int($this->config['eid'])) {
$this->config['eid'] = intval($this->config['eid']);
}
if ($this->config['eid'] <= 0) {
throw new Klarna_ConfigFieldMissingException('eid');
}
if (!is_string($this->config['secret'])) {
$this->config['secret'] = strval($this->config['secret']);
}
if (strlen($this->config['secret']) == 0) {
throw new Klarna_ConfigFieldMissingException('secret');
}
//Set the shop id and secret.
$this->_eid = $this->config['eid'];
$this->_secret = $this->config['secret'];
//Set the country specific attributes.
try {
$this->hasFields('country', 'language', 'currency');
//If hasFields doesn't throw exception we can set them all.
$this->setCountry($this->config['country']);
$this->setLanguage($this->config['language']);
$this->setCurrency($this->config['currency']);
} catch (Exception $e) {
//fields missing for country, language or currency
$this->_country = $this->_language = $this->_currency = null;
}
//Set addr and port according to mode.
$this->mode = (int) $this->config['mode'];
$this->_url = array();
// If a custom url has been added to the config, use that as xmlrpc
// recipient.
if (isset($this->config['url'])) {
$this->_url = parse_url($this->config['url']);
if ($this->_url === false) {
$message = "Configuration value 'url' could not be parsed. " . "(Was: '{$this->config['url']}')";
Klarna::printDebug(__METHOD__, $message);
throw new InvalidArgumentException($message);
}
} else {
$this->_url['scheme'] = 'https';
if ($this->mode === self::LIVE) {
$this->_url['host'] = self::$_live_addr;
} else {
$this->_url['host'] = self::$_beta_addr;
}
if (isset($this->config['ssl']) && (bool) $this->config['ssl'] === false) {
$this->_url['scheme'] = 'http';
}
}
// If no port has been specified, deduce from url scheme
if (!array_key_exists('port', $this->_url)) {
if ($this->_url['scheme'] === 'https') {
$this->_url['port'] = 443;
} else {
$this->_url['port'] = 80;
}
}
try {
$this->hasFields('xmlrpcDebug');
Klarna::$xmlrpcDebug = $this->config['xmlrpcDebug'];
} catch (Exception $e) {
//No 'xmlrpcDebug' field ignore it...
}
try {
$this->hasFields('debug');
Klarna::$debug = $this->config['debug'];
} catch (Exception $e) {
//No 'debug' field ignore it...
}
$this->pcStorage = $this->config['pcStorage'];
$this->pcURI = $this->config['pcURI'];
// Default path to '/' if not set.
if (!array_key_exists('path', $this->_url)) {
$this->_url['path'] = '/';
}
$this->xmlrpc = new xmlrpc_client($this->_url['path'], $this->_url['host'], $this->_url['port'], $this->_url['scheme']);
$this->xmlrpc->setSSLVerifyHost(2);
$this->xmlrpc->request_charset_encoding = 'ISO-8859-1';
}
示例9: removeUserTags
public function removeUserTags($ismachine, $key, $contact, $tags)
{
$url = 'https://' . $ismachine . '.infusionsoft.com:443/api/xmlrpc';
$con = new xmlrpc_client($url);
$con->return_type = 'phpvals';
$con->setSSLVerifyHost(0);
$con->setSSLVerifyPeer(0);
//get the tags
$msg = new xmlrpcmsg('ContactService.removeFromGroup');
$msg->addParam(new xmlrpcval($key));
$msg->addParam(new xmlrpcval((int) $contact, 'int'));
$msg->addParam(new xmlrpcval((int) $tags, 'int'));
$t = $con->send($msg);
if ($t->errno) {
$t = array("errno" => $t->errno, "errstr" => $t->errstr);
} else {
$t = array("value" => $t->value());
}
return $t;
}