$identification
*/
//login
$identification = array (
'utilisateur' => 'username', //User
'motDePasse' => 'password' //Password
);
//Making the final array
$asleep = array (
'identification' => $identification
);
/** XML-RPC **/
//vars
$RpcType = array (
'dureeVie' => 'int',
'nbLicence' => 'int',
'keySize' => 'int',
'typeDemande' => 'int',
'civiliteAdm' => 'int',
'civiliteTech' => 'int',
'civiliteRespLegal' => 'int'
);
$rpcValues = array();
//Functions
//Converts our arrays into RPC-ready data, uses recursivity for structures.
function tab2rpc($tab) {
$tabReturn = false;
if ($tab && is_array($tab)) {
$tabReturn = array();
while (list($key,$val) = each($tab)) {
if ($val && is_array($val)) {
$tabReturn[$key]=new xmlrpcval(tab2rpc($val), "struct");
}else{
if (isset($RpcType[$key])) $type = $RpcType[$key];
else $type = "string";
$tabReturn[$key]=new xmlrpcval($val, $type);
}
}
}
return $tabReturn;
}
//Creating the value array
$rpcValues = tab2rpc($asleep);
//Creating the message
$message = new xmlrpcmsg('enSommeil'); //This value varies depending on the type of operation
$message->addParam(new xmlrpcval($rpcValues,"struct"));
//Client configuration
$client = new xmlrpc_client($appli, $serveur, $port);
$client->setSSLVerifyPeer(false);
$client->setSSLVerifyHost(false);
$client->setDebug(2);
//Sending the request and getting the response
$reponse = $client->send($message, 0, $transport);
$valeur = $reponse->value();
//Trace display
if(!$reponse->faultCode()) {
$msig = php_xmlrpc_decode($valeur);
echo "".nl2br(print_r($msig,true))."
";
echo '
'.$l.' | '.$table['codeReponse'].' | '.$table['messageReponse'].' |
Code: ".$reponse->faultCode()."
Message : ".$reponse->faultString()."
".print_r($reponse, true)."