SimpleXMLRPC

SimpleXMLRPC for PHP4

Download here: SimpleXMLRPC

SimpleXMLRPC differs from other XMLRPC PHP implementations because of
the automatic conversion of a PHP array to an XMLRPC message and VISA VERSA.
So no difficult things with XMLRPC types.

It's all being done automatically!

Besides CURL there are NO special DEPENDENCIES.
A normal installation of PHP4 should do it!

Click this or the link above to download.

Short example of a SimpleXMLRPC communication:


<?php
require_once ('simpleXMLRPCClient.class.php');

$server_path     = '/simplexmlrpc/index.php';
$server_hostname = 'localhost';
$sendHTTPS       = 0;
$serverPort      = NULL;


$xmlrpc = new SimpleXMLRPCClient ();
$xmlrpc->debug = 0;
$xmlrpc->SetXMLRPCServer ($server_hostname, $server_path, $serverPort, $sendHTTPS);

# Array that we want to send
$arrayOfStructs = Array ( Array ('curly' => 3),
                          Array (
'curly' => 2)
                        );

# Create the XMLRPC message with the methodName
$xmlrpc->CreateXMLRPCMessage ('validator1.arrayOfStructsTest');

# Now we simply add the array we want to send with the message
$xmlrpc->AddArray ($arrayOfStructs);

# And now we send it and we get back an array
$array = $xmlrpc->SendXMLRPC ();

# print out the returned array
print_r ($array);

?>

SimpleXMLRPC checks what kind of array is added with the AddArray function.
Because an array is actually a map in PHP all arrays are associative.
To make a distinction between a normally called 'normal' array and an
associative array SimpleXMLRPC checks if all the keys are of type integer
and are increasing in value with 1.
If not then it's assumed that it's an associative array.

THE 'NORMAL' ARRAY HAS TO BE FRESH (NOT MODIFIED) OTHERWISE
THE INDICES MIGHT NOT BE INCREASING WITH 1.