Discussion:
[phpxmlrpc] question about xmlrpcval
Donato Molino
2009-08-09 10:00:56 UTC
Permalink
Hello,

I would like to set in a xmlrpc client an instructions as follow:

$M=count($array);

foreach ($elements as $key => $val) {
for ($d = 0; $d < $M; $d++) {
$VET[$key][$d] = new xmlrpcval($_POST[$key][$d], 'string');
}
}

and then:

$ve=new xmlrpcval( array (
"user" => new xmlrpcval($userid, 'int'),
"VET" => new xmlrpcval($VET, 'struct'),
), 'struct' );

But it fails.

The server method signature is:

$DoInsert_sig=array(array($xmlrpcStruct, $xmlrpcStruct));

Any help would be greatly appreciated.

Donato
Gaetano Giunta
2009-08-10 07:55:35 UTC
Permalink
Post by Donato Molino
Hello,
$M=count($array);
foreach ($elements as $key => $val) {
for ($d = 0; $d < $M; $d++) {
$VET[$key][$d] = new xmlrpcval($_POST[$key][$d], 'string');
}
}
You are missing an encoding level here: $VET is an array-of-arrays, ans
as such cannot be simply encoded later on

$VET = array();
foreach ($elements as $key => $val) {
$arr = array();
for ($d = 0; $d < $M; $d++) {
$arr[$d] = new xmlrpcval($_POST[$key][$d], 'string');
}
$VET[$key] = new xmlrpcval($arr, 'array');
}

You could also try out the easier way to encode: php_xmlrpc_encode() ...

Ciao
Gaetano
Post by Donato Molino
$ve=new xmlrpcval( array (
"user" => new xmlrpcval($userid, 'int'),
"VET" => new xmlrpcval($VET, 'struct'),
), 'struct' );
But it fails.
$DoInsert_sig=array(array($xmlrpcStruct, $xmlrpcStruct));
Any help would be greatly appreciated.
Donato
_______________________________________________
phpxmlrpc mailing list
phpxmlrpc at lists.usefulinc.com
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
Loading...