本文整理汇总了PHP中xmlrpcval::addStruct方法的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpcval::addStruct方法的具体用法?PHP xmlrpcval::addStruct怎么用?PHP xmlrpcval::addStruct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpcval
的用法示例。
在下文中一共展示了xmlrpcval::addStruct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmlrpc_encode
function xmlrpc_encode($php_val)
{
global $xmlrpcInt;
global $xmlrpcDouble;
global $xmlrpcString;
global $xmlrpcArray;
global $xmlrpcStruct;
global $xmlrpcBoolean;
$type = gettype($php_val);
$xmlrpc_val = new xmlrpcval();
switch ($type) {
case "array":
case "object":
$arr = array();
while (list($k, $v) = each($php_val)) {
$arr[$k] = xmlrpc_encode($v);
}
$xmlrpc_val->addStruct($arr);
break;
case "integer":
$xmlrpc_val->addScalar($php_val, $xmlrpcInt);
break;
case "double":
$xmlrpc_val->addScalar($php_val, $xmlrpcDouble);
break;
case "string":
$xmlrpc_val->addScalar($php_val, $xmlrpcString);
break;
// <G_Giunta_2001-02-29>
// Add support for encoding/decoding of booleans, since they are supported in PHP
// <G_Giunta_2001-02-29>
// Add support for encoding/decoding of booleans, since they are supported in PHP
case "boolean":
$xmlrpc_val->addScalar($php_val, $xmlrpcBoolean);
break;
// </G_Giunta_2001-02-29>
// </G_Giunta_2001-02-29>
case "unknown type":
default:
// giancarlo pinerolo <ping@alt.it>
// it has to return
// an empty object in case (which is already
// at this point), not a boolean.
break;
}
return $xmlrpc_val;
}
示例2: _book_request
function _book_request($token, $fac, $rooms, $grooms)
{
$fac->request = 0;
$server = _serv();
$arooms = array();
foreach ($rooms as $rid => $how) {
$fat = new xmlrpcval();
$show = new xmlrpcval($how, 'int');
$srid = new xmlrpcval($rid, 'int');
$fat->addStruct(array('number' => $show, 'id' => $srid));
$arooms[] = $fat;
}
$lcode = $fac->lcode;
$message = new xmlrpcmsg('rooms_request', array(new xmlrpcval($token, 'string'), new xmlrpcval($lcode, 'int'), new xmlrpcval($arooms, 'array')));
$struct = $server->send($message)->value();
$res = _scal($struct, 0);
if ($res < 0) {
return -1;
}
$s = $struct->arraymem(1);
$br = parse_book_request($s);
$fac->request = $br;
return $br;
}
示例3: xmlrpcval
function __phpxmlrpc_encapsulate($arg)
{
// The class xmlrpcval is defined in the phpxmlrpc library. It requires both the variable
// and the type. Dates are handled through the API as ISO 8601 string representations.
if (is_string($arg)) {
$encapArg = new xmlrpcval($arg, 'string');
} elseif (is_int($arg)) {
$encapArg = new xmlrpcval($arg, 'int');
} elseif (is_bool($arg)) {
$encapArg = new xmlrpcval($arg, 'boolean');
} elseif (is_array($arg)) {
// The API server treats indexed arrays (lists) and associative arrays (dictionaries)
// differently where in php they are essentially the same. Assuming that having a zero
// index set indicates an indexed array is not perfect but should suffice for the
// purpose of the API examples.
if (isset($arg[0])) {
$array = array();
foreach ($arg as $key => $value) {
$array[] = $this->__phpxmlrpc_encapsulate($value);
}
$encapArray = new xmlrpcval();
$encapArray->addArray($array);
$encapArg = $encapArray;
} else {
$struct = array();
foreach ($arg as $key => $value) {
$struct[$key] = $this->__phpxmlrpc_encapsulate($value);
}
$encapStruct = new xmlrpcval();
$encapStruct->addStruct($struct);
$encapArg = $encapStruct;
}
} else {
$encapArg = new xmlrpcval($arg, 'string');
}
return $encapArg;
}
示例4: samurai_SessionInitiate
/**
* implements <i>samurai.SessionInitiate</i>
*
* @param string $LocalUri as SIP-URI
* @param string $RemoteUri as SIP-URI
* @param string $TOS Type of service as defined in $availableTOS
* @param string $Content depends on TOS
* @param dateTime $schedule as unix timestamp
*
* @return string SessionID, if available
*
* @throws sipgateAPI_Server_Exception on Server responses != 200 OK
*/
protected function samurai_SessionInitiate($LocalUri, $RemoteUri, $TOS, $Content, $Schedule = NULL)
{
if (isset($LocalUri)) {
$val_a["LocalUri"] = new xmlrpcval($LocalUri);
}
if (isset($RemoteUri)) {
$val_a["RemoteUri"] = new xmlrpcval($RemoteUri);
} else {
throw new sipgateAPI_Exception("No RemoteUri");
}
if (isset($TOS)) {
$val_a["TOS"] = new xmlrpcval($TOS);
} else {
throw new sipgateAPI_Exception("No valid TOS");
}
if (isset($Content)) {
$val_a["Content"] = new xmlrpcval($Content);
}
if (isset($Schedule)) {
$val_a["Schedule"] = new xmlrpcval(iso8601_encode($Schedule), "dateTime.iso8601");
}
$val_s = new xmlrpcval();
$val_s->addStruct($val_a);
$v = array();
$v[] = $val_s;
// create message
$m = new xmlrpcmsg('samurai.SessionInitiate', $v);
// send message
$r = $this->client->send($m);
if (!$r->faultCode()) {
$php_r = php_xmlrpc_decode($r->value());
return $php_r["SessionID"];
} else {
throw new sipgateAPI_Server_Exception($r->faultString(), $r->faultCode());
}
}