[phpxmlrpc] payload problem with xml-rpc

Michele Amori m.amori at eos-software.it
Wed Nov 19 12:13:48 GMT 2003


Hello everyone! I'm a newbie, here, and today I've got a problem that I'd 
like to share with all of you.

This is the error message:
XML-RPC Fault #2: Invalid return payload: enabling debugging to examine 
incoming payload

This is my simple and small "client.php" file:

<html>
<head>
<title>
XML-RPC PHP Demo
</title>
</head>
<body>
<h1>
XML-RPC PHP Demo
</h1>

<?php

include 'xmlrpc.inc';

$server = new xmlrpc_client('/ampcgi/xmlrpc.php','localhost', 80);
$message = new xmlrpcmsg('videoteca.showMovies');
$result = $server->send($message);

// Process the response.
if (!$result) {
         print "<p>Could not connect to HTTP server.</p>";
}
elseif ($result->faultCode()) {
         print "<p>XML-RPC Fault #" . $result->faultCode() . ": " .
             $result->faultString();
}
else {
         echo "OK!";
}

?>

</body>
</html>

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' ) );

}

?>

What's the problem, for you? Thanks so much...

Bye,
Miki 





More information about the phpxmlrpc mailing list