View Source

The following example script shows how to retrieve information about a pooled license.
{info:title=Note}It will require you to put in the '$accOwner', '$accPass', '$licPool'.
{info}
{noformat}
<?php
include 'xmlrpc.inc';
date_default_timezone_set('America/Chicago');

try{
$USERNAME = "";
$PASSWORD = "";
$LICENSEPOOLKEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

$accOwner = $USERNAME;
$accPass = $PASSWORD;
$client = new xmlrpc_client('https://api.r1soft.com/xmlrpc');
$client->setCredentials($accOwner, $accPass);
$client->setSSLVerifyPeer(false);

$licPool = $LICENSEPOOLKEY;
$xmlrpc_msg = new xmlrpcmsg('licensing.getLicensePool', array(
new xmlrpcval($licPool, 'string')
));

$reply = $client->send($xmlrpc_msg);
if (!$reply) {
print "Could not connect to HTTP server.";
} elseif ($reply->faultCode()) {
print "XML-RPC Fault #" . $reply->faultCode() . ": " .
$reply->faultString();
} else {
$val = $reply->value();
$arr = php_xmlrpc_decode($val);
print_r($arr);
}
}
catch (Exception $ex){
echo "Exception happened \n";
echo $ex;
}

?>

{code}
*Output:*



{code}
[root@devtest html]# php testLicApi.php
Array
(
[Enabled] => 1
[Archiving Add-ons Capacity] => 100
[Archiving Add-ons Available] => 91
[Service Provider API Add-on] => 1
[CDP for MySQL Add-ons Available] => 89
[CDP for Control Panels Add-on] => 1
[Windows Agents Available] => 79
[Windows Agents Capacity] => 100
[Linux Agents Capacity] => 125
[CDP for MySQL Add-ons Capacity] => 102
[ID] => 5c3dc847-5dbd-454a-9a5c-1545a02e68ee
[Linux Agents Available] => 104
)
{noformat}\\
\\
\\