PHP5 and XML-RPC
| From: | Jough P | Date: | Sat, 31 Jul 2004 18:00:24 +0000 |
| Subject: | PHP5 and XML-RPC | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13925@lists.php.net to get a copy of this message | ||
Greetings all, I'm copying code straight out of _Advanced PHP Programming_ and am getting the following error on a Linux/Apache/PHP5 box:
Fatal error: Call to a member function kindOf() on a non-object in /usr/local/lib/php/XML/RPC.php on line 1083
I'm wondering if the pear XML-RPC class has any issues with PHP 5. But, I'm just learning how to use XML-RPC and could very well be doing something stupid. ANY help at all would be greatly appreciated.
Here is the code:
CLIENT:
<?php
require_once 'XML/RPC.php';
$client = new XML_RPC_Client('/xmlrpc.php', 'localhost');
$msg = new XML_RPC_Message('system.load');
$result = $client->send($msg);
if($result->faultCode())
echo "Error\n";
print XML_RPC_decode($result->value());
?>
SERVER:
<?php
require_once 'XML/RPC/Server.php';
function system_load()
{
$uptime =
uptime;
if(preg_match("/load average: ([\d.]+/", $uptime, $matches))
{
return new XML_RPC_Response(new XML_RPC_Value($matches[1], 'string'));} } $dispatches = array('system.load' => array('function' => 'system_uptime')); new XML_RPC_Server($dispatches, 1); ?>