R: payload problem with xml-rpc
"Gaetano Giunta" <[email protected]> Wed, 19 Nov 2003 14:24:42 +0100
| Newsgroups | gmane.comp.php.xml-rpc |
|---|---|
| Message-ID | <[email protected]> |
...
>
> And this is my function, in my server file:
>
> <?php
>
> function showMovies() {
>
> $conn = mysql_connect("localhost","user","pwd");
> $db = mysql_select_db("amptestsite",$conn);
> $result = mysql_query("SELECT * FROM movies ORDER BY
> title",$conn);
>
> while ( $rs=mysql_fetch_array($result) ) {
>
> $struct = array(
> 'titolo'=> $rs['title'],
> 'anno' => $rs['year'],
> 'cast' => $rs['cast']
> );
>
> }
>
> return new xmlrpcresp( new xmlrpcval(
> $struct, 'struct' ) );
>
You are probably calling a bad constructor here:
new xmlrpcval( $struct, 'struct' )
>From the docs: $struct should be a PHP array of xmlrpcval objects, not a PHP array of PHP variables.
Either use
$struct = array( 'titolo' => new xmlrpcval($rs['title']), 'anno' => ...
Or just call xmlrpc_encode on a PHP array
Hope this helps
Ciao
Gaetano