This example provides a PHP script for getting a license pool and a return code for this script.
The script allows you to retrieve information about a license pool.
Make sure you specify the following variables:
- Username ($USERNAME)
- Password ($PASSWORD)
- License Pool key ($LICENSEPOOLKEY)
<?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 = "name"; $PASSWORD = "password"; $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; } ?>
Response Example
Here is an example of a response to the XML-RPC request:
Array (
[Server Backup - Enterprise for Physical Servers SB250 (up to 250 servers) Capacity] => 0
[Enabled] => 1
[Server Backup - Enterprise for Virtual Servers SBV50 (up to 50 VMs) Capacity] => 0
[Server Backup - Enterprise for Virtual Servers SBV250 (up to 250 VMs) Capacity] => 0
[Server Backup - Enterprise for Physical Servers SB10 (up to 10 servers) Capacity] => 0
[Server Backup - Enterprise for Physical Servers SB100 (up to 100 servers) Capacity] => 0
[Database Add-ons Available] => 0
[Server Backup - Enterprise for Physical Servers SBX (unlimited site license for physical servers) Capacity] => 0
[Virtual Servers Capacity] => 0
[Server Backup - Enterprise for Virtual Servers SBVX (unlimited site license for virtual servers) Capacity] => 0
[Physical Servers Available] => 3
[Server Backup - Enterprise for Physical Servers SB5 (up to 5 servers) Capacity] => 0
[unknown Available] => 10
[ID] => retertwre-432423-2342-be53-23423424234
[Server Backup - Enterprise for Virtual Servers SBV1000 (up to 1000 VMs) Capacity] => 0
[Physical Servers Capacity] => 50
[Server Backup - Enterprise for Physical Servers SB25 (up to 25 servers) Capacity] => 0 )
Labels:
None