PHP code example of shift31 / hostbase-api-client

1. Go to this page and download the library: Download shift31/hostbase-api-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shift31 / hostbase-api-client example snippets




hift31\HostbaseClient;

/* The constructor will accept username and password parameters,
if you setup basic auth yourself, or for when I get around to implementing it. */
$client = new HostbaseClient("http://your.hostbase.server");

/* Optionally return arrays instead of objects */
//$client->decodeJsonAsArray();


// perform a search, limiting to 100 servers, retrieving just FQDNs
print_r($client->search('your.domain', 100, false));

// perform the same search, retrieving all data
print_r($client->search('your.domain', 100, true));