本文整理汇总了PHP中XML_RPC_Message::setSendEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP XML_RPC_Message::setSendEncoding方法的具体用法?PHP XML_RPC_Message::setSendEncoding怎么用?PHP XML_RPC_Message::setSendEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML_RPC_Message
的用法示例。
在下文中一共展示了XML_RPC_Message::setSendEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XML_RPC_Server_system_multiCall
/**
* Executes multiple methods in sequence and returns the results
* (implements http://www.xmlrpc.com/discuss/msgReader$1208)
*
* @return object a new XML_RPC_Response object
*/
function XML_RPC_Server_system_multiCall($server, $msg)
{
$dmap = $server->dmap;
$array = $msg;
for ($i = 0; $i < $array->getNumParams(); $i++) {
$details = $array->getParam($i);
if ($details->kindOf() != 'struct') {
$resp = new XML_RPC_Response(0, $GLOBALS['XML_RPC_err']['incorrect_params'], "system_multiCall() expects _only_ struct datatypes wrapped in one array.");
} elseif ($details->arraysize() >= 1) {
// check if method name a string pointing to valid function
if (!is_a($method_obj = $details->structmem('methodName'), 'XML_RPC_value') || $method_obj->kindOf() != 'scalar' || !($method = $method_obj->scalarVal()) || !strlen($function = $dmap[$method]['function'])) {
$resp = new XML_RPC_Response(0, $GLOBALS['XML_RPC_err']['incorrect_params'], "system_multiCall() method call '{$method}' type '" . gettype($method) . "' resolves to an invalid function. Parameter or dmap configuration problem?");
} elseif (($params = $details->structmem('params')) && (!is_a($params, 'XML_RPC_Value') || $params->kindOf() != 'array')) {
$resp = new XML_RPC_Response(0, $GLOBALS['XML_RPC_err']['incorrect_params'], "system_multiCall() method call '{$function}' parameters container " . "is not a XML_RPC_Value type '{$GLOBALS['XML_RPC_Array']}'.");
} elseif (preg_match("/\\bsystem_multiCall\$/i", $function)) {
$resp = new XML_RPC_Response(0, $GLOBALS['XML_RPC_err']['incorrect_params'], "system_multiCall() must not be called recursively.");
} else {
// build array containing xml_rpc_value of each param
$params_list = array();
for ($j = 0; isset($params) && $j < $params->arraysize(); $j++) {
$params_list[] = $param = $params->arraymem($j);
}
$msg = new XML_RPC_Message($method, $params_list);
$msg->setSendEncoding($server->encoding);
$resp = $server->execute($function, $msg);
}
} else {
$resp = new XML_RPC_Response(0, $GLOBALS['XML_RPC_err']['incorrect_params'], "system_multiCall() must be called with at" . "least the functions name as parameter 1");
}
// convert error to struct (multiCall Spec)
if (!$resp->faultCode()) {
$xml_response = array();
$xml_response[] = $resp->value();
$values[] = new XML_RPC_Value($xml_response, 'array');
//$values[] = $resp->value();
} else {
$value = new XML_RPC_Value();
$value->addStruct(array('faultCode' => new XML_RPC_Value($resp->faultCode(), $GLOBALS['XML_RPC_Int']), 'faultString' => new XML_RPC_Value($resp->faultString(), $GLOBALS['XML_RPC_String'])));
$values[] = $value;
}
}
$v = new XML_RPC_Value();
$v->addArray($values);
return new XML_RPC_Response($v);
}