PHP code example of gohrco / whmcsapi

1. Go to this page and download the library: Download gohrco/whmcsapi 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/ */

    

gohrco / whmcsapi example snippets




use Gohrco\Whmcsapi;

// create an API handler
$api		=	new Whmcsapi();

// Set options
$api->setUsername( 'apiadmin' );
$api->setPassword( 'password' );
$api->setUrl( 'http://url.to.your/whmcs/' );
$api->setLogpath( '\absolute\path\to\log\entries' );

// Init
$api->init();

// Call API up
$result		=	$api->getclientsdetails( array( 'userid' => 1 ) );

$api    = new Whmcsapi( array( 'username' => 'apiadmin', 'password' => 'password', 'url' => 'http://url.to.your/whmcs/', 'logpath' => '\absolute\path\to\log\entries' ) );
$result = $api->getclientsproducts( array( 'userid' => 1 ) );

$api->addorder();
$api->getclients();
$api->addbannedip();
...