本文整理汇总了PHP中XML_RPC_Client::setAutoBase64方法的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Client::setAutoBase64方法的具体用法?PHP XML_RPC_Client::setAutoBase64怎么用?PHP XML_RPC_Client::setAutoBase64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_RPC_Client
的用法示例。
在下文中一共展示了XML_RPC_Client::setAutoBase64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file_get_contents
*/
require_once MAX_PATH . '/lib/Max.php';
require_once MAX_PATH . '/lib/max/Delivery/adSelect.php';
require_once MAX_PATH . '/lib/max/Delivery/flash.php';
require_once MAX_PATH . '/lib/OX.php';
require_once 'XML/RPC/Server.php';
// Set a global variable to let the other functions know
// they are serving an XML-RPC request. Needed for capping
// on request
$GLOBALS['_OA']['invocationType'] = 'xmlrpc';
// Workaround for PHP bug #41293 (PHP-5.2.2)
if (empty($GLOBALS['HTTP_RAW_POST_DATA'])) {
$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
}
// Set automatic Base64 encoding in XML-RPC response
XML_RPC_Client::setAutoBase64(true);
/**
* New OpenX signature / docs
*
* @since 2.3.32-beta
*/
$xmlRpcView_OA = array('sig' => array(array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_Int'], $GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_Boolean'], $GLOBALS['XML_RPC_Array'])), 'doc' => 'When passed the "environment/cookies" struct, "what", "campaignid", "target", "source", ' . '"withText", "context" returns the cookies to be set and the HTML code to display the ' . 'appropriate advertisement.');
/**
* New OpenX signature / docs for SPC XML-RPC method
*
* @since 2.5.2-dev
*/
$xmlRpcSPC_OA = array('sig' => array(array($GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_Struct'], $GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_Boolean'], $GLOBALS['XML_RPC_Boolean'], $GLOBALS['XML_RPC_Boolean'])), 'doc' => 'When passed the "environment/cookies" struct, "what", "target", "source", ' . '"withtext", "block" and "blockcampaign" returns the cookies to be set and an array of HTML code to display the ' . 'selected advertisements.');
/**
* MMM 0.3 / OpenX 2.3 backwards compatible signature / docs
*/
示例2: spc
function spc($what, $target = '', $source = '', $withtext = 0, $block = 0, $blockcampaign = 0, $charset = '')
{
global $XML_RPC_String, $XML_RPC_Boolean;
global $XML_RPC_Array, $XML_RPC_Struct;
global $XML_RPC_Int;
// Prepare variables
$aServerVars = array('remote_addr' => 'REMOTE_ADDR', 'remote_host' => 'REMOTE_HOST', 'request_uri' => 'REQUEST_URI', 'https' => 'HTTPS', 'server_name' => 'SERVER_NAME', 'http_host' => 'HTTP_HOST', 'accept_language' => 'HTTP_ACCEPT_LANGUAGE', 'referer' => 'HTTP_REFERER', 'user_agent' => 'HTTP_USER_AGENT', 'via' => 'HTTP_VIA', 'forwarded' => 'HTTP_FORWARDED', 'forwarded_for' => 'HTTP_FORWARDED_FOR', 'x_forwarded' => 'HTTP_X_FORWARDED', 'x_forwarded_for' => 'HTTP_X_FORWARDED_FOR', 'client_ip' => 'HTTP_CLIENT_IP');
// Create environment array
$aRemoteInfo = array();
foreach ($aServerVars as $xmlVar => $varName) {
if (isset($_SERVER[$varName])) {
$aRemoteInfo[$xmlVar] = $_SERVER[$varName];
}
}
// Add cookies
$aRemoteInfo['cookies'] = $_COOKIE;
// If an array of zones was passed into $what, then serialise this for the XML-RPC call
if (is_array($what)) {
$what = serialize($what);
}
XML_RPC_Client::setAutoBase64(true);
// Create the XML-RPC message
$message = new XML_RPC_Message('openads.spc', array(XML_RPC_encode($aRemoteInfo), new XML_RPC_Value($what, $XML_RPC_String), new XML_RPC_Value($target, $XML_RPC_String), new XML_RPC_Value($source, $XML_RPC_String), new XML_RPC_Value($withtext, $XML_RPC_Boolean), new XML_RPC_Value($block, $XML_RPC_Boolean), new XML_RPC_Value($blockcampaign, $XML_RPC_Boolean)));
// Create an XML-RPC client to talk to the XML-RPC server
$client = new XML_RPC_Client($this->path, $this->host, $this->port);
// Send the XML-RPC message to the server
$response = $client->send($message, $this->timeout, $this->ssl ? 'https' : 'http');
// Was the response OK?
if ($response && $response->faultCode() == 0) {
$response = XML_RPC_decode($response->value());
if (isset($response['cookies']) && is_array($response['cookies'])) {
foreach ($response['cookies'] as $cookieName => $cookieValue) {
setcookie($cookieName, $cookieValue[0], $cookieValue[1]);
}
}
unset($response['cookies']);
return $this->_convertEncoding($response, $charset);
}
return array('html' => '', 'bannerid' => 0, 'campaignid' => 0);
}