This example provides a PHP script for getting license pools and a return code for this script.
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.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; } ?>
Response Example
Here is an example of a response to the XML-RPC request:
Array (
[0] => 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] => 96 [SubscriptionExpireDate] => 20111110T10:41:32
[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] => 96
[Server Backup - Enterprise for Physical Servers SB5 (up to 5 servers) Capacity] => 0
[ID] => 0a411a63-a6fc-4df6-80bd-279ece41cf85
[Server Backup - Enterprise for Virtual Servers SBV1000 (up to 1000 VMs) Capacity] => 0
[Physical Servers Capacity] => 100
[Server Backup - Enterprise for Physical Servers SB25 (up to 25 servers) Capacity] => 0
)
[1] => 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] => 5e99ea40-d986-4ec5-be53-202e2749dba5
[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
)
[2] => 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
[SubscriptionExpireDate] => 20110625T11:36:05
[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] => 43
[Server Backup - Enterprise for Physical Servers SB5 (up to 5 servers) Capacity] => 0
[ID] => b9471d1c-2f64-4e03-8a12-9bb5970504ae
[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