This example provides you a PHP script for getting a license pool and a return code for this script.
The script shows how to retrieve information about a pooled license.
Note It will require you to put in the '$accOwner', '$accPass', '$licPool'. |
Example 1
<?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.getLicensePool', array( new xmlrpcval($licPool, 'string') )); $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; } ?>
Output
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 )
Example 2
<?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; } ?>
Output
Array ( [Enabled] => 1 [CDP 3 Generic Agents Available] => 3 [CDP 3 MySql Backups Capacity] => 13 [unknown Available] => 0 [ID] => xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx [CDP 3 MySql Backups Available] => 5 [unknown Capacity] => 0 [CDP 3 Generic Agents Capacity] => 13 )
Labels:
None