The following script shows how to embed XML-RPC calls into a web page.
<html> <head> <title>XML-RPC PHP Demo</title> </head> <body> <h1>XML-RPC PHP Demo</h1> <?php include 'xmlrpc.inc'; // Make an object to represent our server. $server = new xmlrpc_client('/api/sample.php', 'xmlrpc-c.sourceforge.net', 80); // Send a message to the server. $message = new xmlrpcmsg('sample.sumAndDifference', array(new xmlrpcval(5, 'int'), new xmlrpcval(3, 'int'))); $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 { $struct = $result->value(); $sumval = $struct->structmem('sum'); $sum = $sumval->scalarval(); $differenceval = $struct->structmem('difference'); $difference = $differenceval->scalarval(); print "<p>Sum: " . htmlentities($sum) . ", Difference: " . htmlentities($difference) . "</p>"; } ?> </body></html>
If your webserver doesn't run PHP scripts, see the PHP website for more information.