View Source

This example provides you a PHP script for getting license pools and a return code for this script.
{noformat}
<?php
include 'xmlrpc.inc';
date_default_timezone_set('America/Chicago');

try{
#### User settings Start ####
## For this example the user should only have to change these settings
$USERNAME = "adevroy";
$PASSWORD = "qwerty1234";
$LICENSEPOOLKEY = "19ac9483-9fee-43a8-b796-b416d9868039";
#### User settings End ####

#### Common Settings Start ####
$accOwner = $USERNAME;
$accPass = $PASSWORD;
$licPool = $LICENSEPOOLKEY;
#### Common Settings End ####

#### Create Client Start ####
$client = new xmlrpc_client('https://api.r1soft.com/xmlrpc');
$client->setCredentials($accOwner, $accPass);
$client->setSSLVerifyPeer(false);
#### Create Client End ####

#### Make RPC Call Start ####
$xmlrpc_msg = new xmlrpcmsg('licensing.getLicensePools', array(
));
$reply = $client->send($xmlrpc_msg);
#### Make RPC Call End ####

#### Process Reply Start ####
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);
}
#### Process Reply End ####
}
catch (Exception $ex){
echo "Exception happened \n";
echo $ex;
}

?>
{noformat}

h5.Output
{noformat}
Array
(
[0] => Array
(
[Enabled] => 1
[CDP 3 Generic Agents Available] => 1
[CDP 3 MySql Backups Capacity] => 5
[unknown Available] => 0
[ID] => 2d75bcf6-ce8a-4542-8063-36bdfa6afb10
[CDP 3 MySql Backups Available] => 1
[unknown Capacity] => 0
[CDP 3 Generic Agents Capacity] => 5
)

[1] => Array
(
[Enabled] => 1
[CDP 3 Generic Agents Available] => 3
[CDP 3 MySql Backups Capacity] => 13
[unknown Available] => 0
[ID] => 19ac9483-9fee-43a8-b796-b416d9868039
[CDP 3 MySql Backups Available] => 5
[unknown Capacity] => 0
[CDP 3 Generic Agents Capacity] => 13
)

[2] => Array
(
[Enabled] => 1
[Archiving Add-ons Capacity] => 3
[Archiving Add-ons Available] => 2
[Service Provider API Add-on] => 1
[CDP for MySQL Add-ons Available] => 3
[CDP for Control Panels Add-on] => 1
[Windows Agents Available] => 3
[Windows Agents Capacity] => 4
[Linux Agents Capacity] => 4
[CDP for MySQL Add-ons Capacity] => 4
[ID] => bf824abd-7e9c-46ef-b3eb-5973234b462e
[Linux Agents Available] => 3
)

)
{noformat}