$identification
|-> $application
|-> $certificate
|-> $product
|-> $request
|-> $CSR
|-> $organization
|-> $contactAdm
|-> $contactTech
|-> $billingOrganization
|-> $payment
|-> $misc
*/
//login
$identification = array (
'utilisateur' => 'username', //User
'motDePasse' => 'password' //Password
);
//Certificate to renew
//Only one is necessary
$certificate = array(
'refTBS' => '', //TBS reference
'refCA' => '12345789' //CA reference
);
/*Applicaiton*/
//Product
$product = array(
'code' => 'COM3s2ucc', //Product code, see our documentation.
'dureeVie' => '1' //Product duration, can be '1','2' , '3' (years) or '90' (days)
);
//Certificate information
$CSR = '-----BEGIN CERTIFICATE REQUEST-----
MIICojCCAYoCAQAwXTELMAkGA1UEBhMCRlIxETAPBgNVBAgMCENhbHZhZG9zMQ0w
CwYDVQQHDARDYWVuMRUwEwYDVQQKDAxUQlMgSU5URVJORVQxFTATBgNVBAMMDGVh
c3l4NTA5LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKwPSe7/
v5dTJNEng9FjPqCa6mnLWE5emIZql5ecXzHkFNs3ng0azZ+6FHwklWsvsLQk7/hA
ZNzpZjstoubgW3RPoigtjB0zFEcRYucH7B88svcmJGtdiGm2efWMEXSGLCIwc6qn
R53MbIme2jrtgpHntapxv+cwtF0I8vvUCT/jV7VXMwHPiAEl70XJE8HkAKCNS224
Pes0wtLwUM5p6mWAucOf8sYcH//bMCQqoSiQQURZ/qabBaD3VSMJCwktqL1zvoKe
XVBbU78mg+6kK/nIQrMPr2QfexJ9TCdpBIp1n+o/qwtzUZx3cUpCtbV/LGP189WN
m1FRdy4jZ8U0N98CAwEAAaAAMA0GCSqGSIb3DQEBBQUAA4IBAQAa3Y8kILDkMqGn
bMJcEWGz1coHGm93S8du3dajR2SnDSfuNuhUgKTfFzESbS7MKHaVkTZDpqnV4ZLz
B1de2Pk/W1l0ku18apWWTsVUB7Zc5MUO2QSrsVngZJe9gP23nJ6VVdgEy7RHSF4n
2A7LvQc7CvL6fk596cgO05/+p8UKmv2nTI1bSuBF/gBPj3aTjznkQJqEamkJntv0
34BZGgnHv9NElCXNWRHxx7LlJFV+jw6nexyWN7AcmmXNFWJYBpFhWNPcU7u4D+KI
3DK1riC1VS2/M/Msr17WOO8EmAR+suZN7CsDVwh/7RN3wKraQ1b88quLImfUgn4Q
Xe8Spw3a
-----END CERTIFICATE REQUEST-----'; //Base64-encoded CSR //TODO : Remove CSR and add a comment.
$request = array(
'logiciel' => 'Apache2', //Software used : see our documentation for our sofware codes.
'nbLicence' =>'', //Number of licenses for product requiring licenses, e.g. Symantec Secure Site or TBS X509 omnidomaine.
'CSR' => $CSR,
'domainePrincipal' => 'example.com', //TODO: Change example domain
'domaines' => 'example.com', //TODO: Change example domain
'cloneTBS' => '', //If clonning, precise the TBS reference
'accompagnement' => 'non', //oui (yes) or non (no)
'clefPrive' => '', //TODO: document
'adresseDVC' => 'dcv@example.com' //See DCV comment below.
);
/*DCV:
Possible values for the DCV:
- Valid email adress : Must be in the WHOIS or a special adress from the followinf list :
admin@domain.tld, administrator@domain.tld, hostmaster@domain.tld, postmaster@domain.tld, or webmaster@domain.tld.
- HTTP_CSR_HASH : HTTP file validation
- HTTPS_CSR_HASH : HTTPS file validation
- CNAME_CSR_HASH : CNAME DNS validation
*/
//Organization
$organization = array (
'siren'=> '123456789', //National identification number, i.e SIREN for French companies
'typeOrg'=> 'FRRCS', //Organization type, see our documentation
'nom'=> 'Example Corp', //Official organization name, not a commercial name
'adresse1'=> '42 StreetName', //Address fields
'adresse2'=> '',
'adresse3'=> '',
'ville'=> 'City', //City
'codePostal'=> '12345', //Postal Code
'pays'=> 'FR', //iso-3166 country code
'state'=> 'Some State', //State/Province/Département/etc
'telephone'=> '+33-1-2345-6789', //Phone number, optionnal
'fax'=> '', //Fax number, optionnal
'codeNAF'=> '1356', //NAF Code, see our documentation
'numTVA'=> 'FR01234567890', //VAT Number, optionnal
'siteWeb'=> "example.com" //Website, optionnal
);
//Administrative Contact
$contactAdm = array (
'nomAdm'=>'Test', //Lastname
'prenomAdm'=>'John', //Firstname
'fonctionAdm'=>'CEO', //Function
'telAdm'=>'+33-2-7630-5900', //Phone number
'emailAdm'=>'john.test@example.com', //Email address TODO: Change
);
//Technical Contact
$contactTech = array (
'nomTech'=>'Test', //Lastname
'prenomTech'=>'Jane', //Firstname
'fonctionTech'=>'IT', //Function
'telTech'=>'+33-2-7630-5900', //Phone number
'emailTech'=>'jane.test@example.com' //Email //Todo: Change
);
//Billing organization, optional
$billingOrganization = array (
'siren'=> '', //National identification number, i.e SIREN for French companies
'nom'=> 'Example Corp', //Official organization name, not a commercial name
'adresse1'=> '42 StreetName', //address fields
'adresse2'=> '',
'adresse3'=> '',
'ville'=> 'City', //City
'codePostal'=> '12345', //Postal Code
'pays'=> 'FR', //iso-3166 country code
'state'=> 'SomeState', //State/Province/Département/etc
'telephone'=> '+33-1-2345-6789', //Phone number, optionnal
'codeNAF'=> '1356', //NAF Code, see our documentation
'numTVA'=> 'FR01234567890', //VAT Number, optionnal
'melCompta'=> "accounting@example.com" //Accounting department's e-mail
);
$payment = array (
'modePaiement'=>'0ch', //Payment method, see our documentation
'devis'=> 'non' //Quotation ? oui (yes) or non (no)
);
$misc = array (
'codePromo'=> '', //Optionnal promotionnal code
'notesClient'=>'', //Optional note you might want to leave
'refClient'=> '' //Your (optionnal) reference
);
//Main order information
$application = array(
'refDemande' => '',
'certificat' => $certificate,
'produit' => $product,
'requete' => $request,
'organisation' => $organization,
'contactAdm' => $contactAdm,
'contactTech' => $contactTech,
'compagnieFact' => $billingOrganization,
'paiement' => $payment,
'divers' => $misc
);
//Making the final array
$renew = array (
'identification' => $identification,
'demande' => $application
);
/** XML-RPC **/
//vars
$RpcType = array (
'dureeVie' => 'int',
'nbLicence' => 'int',
'keySize' => 'int',
'typeDemande' => '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($renew);
//Creating the message
$message = new xmlrpcmsg('renouvellement'); //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)."