The following PHP script is used to generate a new license key from the License Pool.
Required variables are:
- Number of Generic Agents
- Number if MySql Backups
Note You will be required to specify the '$accOwner', '$accPass', '$licPool' variables. |
<?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"; $LICENSETYPE = "CDP3 Enterprise Server Pool"; $GENERICAGENTS = '1'; $MYSQLADDONS = '1'; #### 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.createPooledLicense', array( new xmlrpcval($LICENSEPOOLKEY, "string"), new xmlrpcval($LICENSETYPE, "string"), new xmlrpcval( array( "CDP 3 Generic Agents" => new xmlrpcval($GENERICAGENTS, "int"), "CDP 3 MySql Backups" => new xmlrpcval($MYSQLADDONS, "int") ), "struct"), ),"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; } ?>
Labels:
None