<?php
require_once './adresse.php';
require_once 'XML/RPC2/Client.php';

$options = array(
    'prefix' => 'abe.'
);

// We make the XML_RPC2_Client object (as the backend is not specified, XMLRPCEXT
// will be used if available (full PHP else))
$client = XML_RPC2_Client::create(ADDR_SERVER, $options);

function RPC_execute($commande,$param)
{
	global $client;
	try {
	    // Because of the prefix specified in the $options array, indeed,  we will call
	    // the package.info() method with a single argument (the string 'XML_RPC2')
	    $result = $client->{$commande}($param);
	    // $result is a complex PHP type (no XMLRPC decoding needed, it's already done)
	    //print_r($result);
	    return $result;
	} catch (XML_RPC2_FaultException $e) {
	    // The XMLRPC server returns a XMLRPC error
	    die('Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString());
	} catch (Exception $e) {
	    // Other errors (HTTP or networking problems...)
	    die('Exception : ' . $e->getMessage());
	}
}

//print_r(RPC_execute('getAllListsOfItems','d'));
//print_r(RPC_execute('getNameOfLists',''));
//print_r(RPC_execute('getListOfItems','TYPES'));
//print_r(RPC_execute('getListAllDocs',''));
//print_r(RPC_execute('getLastFiveDocs',''));
//print_r(RPC_execute('getBestFiveDocs',''));

?>

