Version 6 by Pete Onni
on Mar 10, 2010 22:32.

compared with
Current by Nata Ramanenka
on Nov 07, 2012 13:03.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (30)

View Page History
{page-title}
This document provide you with scripts for passing needed variables when issuing CDP Server key.

h4. Script 1

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}
{code} {noformat}
<?php
include 'xmlrpc.inc';
require_once('xmlrpc.inc'); date_default_timezone_set('America/Chicago');
$accOwner = '';
$accPass = '';
$licPool = '';

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->debug = true;
$xmlrpc_msg = new xmlrpcmsg('licensing.getLicense', array(
new xmlrpcval($licPool, 'string')
)); $client->setSSLVerifyPeer(false);

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

$reply = $client->send($xmlrpc_msg);
if (!$reply) {
print "<p>Could not connect to HTTP server.</p>";
print "Could not connect to HTTP server.";
} } elseif ($reply->faultCode()) {
print 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
[Linux Agents Available] => 104
)
{code}\\ {noformat}\\
\\
\\

h4. Script 2

The following script is used to generate a new license key from the License Pool. Required variables are:
* \# Linux Agents
* \# Windows Agents
* \# Archive Add-on modules
* \# MySQL Add-on modules
* API Utility: True/False
* Control Panel Utility: True/False
{info:title=Note}You will be required to put in the '$accOwner', '$accPass', '$licPool'.
{info}
{code}
<?php

require_once('xmlrpc.inc');

$accOwner = '';
$accPass = '';
$licPool = '';
$licType = 'CDP Server Stand Alone (Linux)';
$client = new xmlrpc_client('https://api.r1soft.com/xmlrpc');
$client->setCredentials($accOwner, $accPass);
#$client->debug = true;
// License properties
$linAgents = '5';
$winAgents = '5';
$cpAddOn = '1';
$mysqlAddOn = '3';
$apiAddOn = '1';
$archiveAddOn = '2';
$pooledLicense = '1';
// end license properties

$xmlrpc_msg = new xmlrpcmsg('licensing.createPooledLicense', array(
new xmlrpcval($licPool, "string"),
new xmlrpcval($licType, "string"),
new xmlrpcval(
array(
"Linux Agents" => new xmlrpcval($linAgents, "int"),
"Windows Agents" => new xmlrpcval($winAgents, "int"),
"CDP for Control Panels Add-on" => new xmlrpcval($cpAddOn, "boolean"),
"CDP for MySQL Add-ons" => new xmlrpcval($mysqlAddOn, "int"),
"Service Provider API Add-on" => new xmlrpcval($apiAddOn, "boolean"),
"Archiving Add-ons" => new xmlrpcval($archiveAddOn, "int"),
"Pooled License" => new xmlrpcval($pooledLicense, "boolean")
), "struct"),
),"array"
);

$reply = $client->send($xmlrpc_msg);
if (!$reply) {
print "<p>Could not connect to HTTP server.</p>";
} elseif ($reply->faultCode()) {
print "XML-RPC Fault #" . $reply->faultCode() . ": " .
$reply->faultString();
} else {

$val = $reply->value();
$arr = php_xmlrpc_decode($val);
print_r($arr);
}
?>
{code}
*Output:*
{code}
[root@devtest html]# php licenseAdd.php
Array
(
[Enabled] => 1
[Product] => CDP Server Stand Alone (Linux)
[Windows Agents] => 5
[Type] => Pooled License
[CDP for MySQL Add-ons] => 3
[Linux Agents] => 5
[License Pool ID] => 5c3dc847-5dbd-454a-9a5c-1545a02e68ee
[Archiving Add-ons] => 2
[ID] => 60486d4e-24f4-4a8d-8d24-46abeb4eb0f1
[Installed] =>
)
{code}{excerpt:hidden=true}Scripts for passing needed variables for issuing CDP Server key.{excerpt}