1. Go to this page and download the library: Download eugenevdm/whm-api 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/ */
eugenevdm / whm-api example snippets
ugenevdm\WhmApi\Cpanel;
$cpanel = new src\Cpanel([
'host' => 'https://1.2.3.4:2087', // ip or domain complete with its protocol and port
'username' => 'root', // username of your server, it is usually root
'auth_type' => 'hash', // set 'hash' or 'password'
'password' => 'password', // long hash or your user's password
]);
$accounts = $cpanel->listaccts(); // results returned as an array
echo print_r($accounts, true);
// get bandwidth data of specific cPanel's user
$data = $cpanel->cpanel('Bandwidth', 'getbwdata', 'username');
// removing cron line
$data = $cpanel->cpanel('Cron', 'remove_line', 'username', ['line'=>1]);
// get bandwidth data of specific cPanel's user (using cPanel API 2)
$data = $cpanel->execute_action('2', 'Bandwidth', 'getbwdata', 'username');
// removing email address (using UAPI)
$data = $cpanel->execute_action('3', 'Email', 'delete_pop', 'username', ['email'=>'[email protected]']);
// change username and (password or hash)
$cpanel->setAuthorization($username, $password);
// change host
$cpanel->setHost($host);
// change authentication type
$cpanel->setAuthType($auth_type);
// get username
$cpanel->getUsername();
// get password
$cpanel->getPassword();
// get authentication type
$cpanel->getAuthType();
// get host
$cpanel->getHost();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.