R: [phpxmlrpc] payload problem with xml-rpc

Gaetano Giunta giunta.gaetano at sea-aeroportimilano.it
Wed Nov 19 13:24:42 GMT 2003


...

> 
> 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




More information about the phpxmlrpc mailing list