[Gandi][Api] Hosting script example

[Gandi][Api] Hosting script example.
1) Installation :
– Working directory :

[~] ➔ mkdir -p API/Domain
[~] ➔ cd API/Domain/
[~/API/Domain] ➔

– Pear and XML_RPC2 installation :

[~/API/Domain] ➔ sudo apt-get install php5-cli
[~/API/Domain] ➔ sudo apt-get install php-pear
[~/API/Domain] ➔ sudo pear update-channels
[~/API/Domain] ➔ sudo pear upgrade-all
[~/API/Domain] ➔ sudo pear install XML_RPC2

2) Hosting image list :
api_hosting.php :

< ?php require_once 'XML/RPC2/Client.php'; $apikey = '< api key>';
// Image available list
$api_hosting = XML_RPC2_Client::create(
'https://rpc.gandi.net/xmlrpc/',
array( 'prefix' => 'hosting.image.', 'sslverify' => False )
);
$result = $api_hosting->list($apikey);
print_r($result);
?>

Result:

Array
(
[0] => Array
(
[date_updated] => stdClass Object
(
[scalar] => 20110419T17:08:35
[xmlrpc_type] => datetime
[timestamp] => 1303232915
)
[os_arch] => x86-32
[label] => GandiOS
[datacenter_id] => 1
[kernel_version] => 2.6.27 (deprecated)
[visibility] => all
[disk_id] => 81346
[date_created] => stdClass Object
(
[scalar] => 20070101T00:00:00
[xmlrpc_type] => datetime
[timestamp] => 1167609600
)
[author_id] => 248842
[id] => 1
[size] => 3072
)
...
[71] => Array
(
[date_updated] => stdClass Object
(
[scalar] => 20150929T14:56:29
[xmlrpc_type] => datetime
[timestamp] => 1443538589
)
[os_arch] => x86-64
[label] => FreeBSD 10.2 64 bits (UFS) (beta)
[datacenter_id] => 2
[kernel_version] => raw
[visibility] => all
[disk_id] => 7504193
[date_created] => stdClass Object
(
[scalar] => 20150929T14:56:29
[xmlrpc_type] => datetime
[timestamp] => 1443538589
)
[author_id] => 248842
[id] => 230
[size] => 3072
)
)

Comments are closed, but trackbacks and pingbacks are open.