|
Project Information
Featured
Downloads
|
Hosting Reborn API librariesWhat is it?Hosting Reborn is a pay-as-you-go shared web hosting provider. The underlying platform exposes a web-based API with which any program written in any language can directly interact. This project features Hosting Reborn's own PHP programming libraries for making the process of talking to the API from your programs a lot easier. Documentation for the API itself (not these libraries) is at http://api.hostingreborn.com/docs/. View the PHPDOC generated documentation: http://hostingreborn.googlecode.com/hg/php/apidocs/index.html Examples, Support and so onThis project is very new - there are currently few examples and no support. Examples and tutorials will come soon. API OverviewThe API provides methods for dealing with:
Quick examplesPricing: getting the current prices<?php
$priceApi = new HR_priceApi();
$prices = $priceApi->get();
var_dump($prices);
/**
* array(2) {
* ["storage"]=>
* float(0.5)
* ["bandwidth"]=>
* int(50)
* }
*/
?>Servers: getting details for a server<?php
$serverApi = new HR_serverApi();
$server = $serverApi->get('78.31.104.54');
var_dump($server);
/**
* array(3) {
* ["ip"]=>
* string(12) "78.31.104.54"
* ["hostname"]=>
* string(20) "core.webignition.net"
* ["name"]=>
* string(6) "George"
* }
*/
?>Account: get your API key (needed for all authenticated requests)<?php $accountApi = new HR_accountApi(); $key = $accountApi->getKey($email, $password); var_dump($key); /** * string(32) "f8ddb9cbb321d7dfbf6cb059736f0b3d" */ ?> Account: get current balance<?php $accountApi = new HR_accountApi(); $key = $accountApi->getKey($email, $password); $balance = $accountApi->getBalance($key); var_dump($balance); /** * float(3448.24130492) */ ?> Hosting accounts: get details for a hosting account<?php
$hostingaccountApi = new HR_hostingaccountApi();
$hostingaccount = $hostingaccountApi->get($key, 'blog.hostingreborn.com');
/**
* array(15) {
* ["domain"]=>
* string(25) "blog.hostingreborn.com"
* ["username"]=>
* string(8) "<removed>"
* ["owner"]=>
* string(21) "jon@hostingreborn.com"
* ["creationtime"]=>
* string(19) "2008-06-06 21:56:20"
* ["serverip"]=>
* string(12) "78.31.104.54"
* ["storagelimit"]=>
* string(3) "500"
* ["bandwidthlimit"]=>
* string(4) "2000"
* ["storageusage"]=>
* string(8) "86659072"
* ["bandwidthusage"]=>
* string(9) "136123751"
* ["storagecost"]=>
* string(1) "54.5712"
* ["bandwidthcost"]=>
* string(1) "6.3388"
* ["status"]=>
* string(6) "active"
* ["suspendedby"]=>
* NULL
* ["suspensioncategory"]=>
* NULL
* ["suspensionreason"]=>
* NULL
* }
*/
?>
|