1. Go to this page and download the library: Download chrisbjr/cpanel-php 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/ */
chrisbjr / cpanel-php example snippets
$cpanel = new \Gufy\CpanelPhp\Cpanel([
'host' => 'https://123.456.789.123:2087', // ip or domain complete with its protocol and port
'username' => 'root', // username of your server, it usually root.
'auth_type' => 'hash', // set 'hash' or 'password'
'password' => 'password', // long hash or your user's password
]);
$accounts = $cpanel->listaccts(); // it will returned as array
// 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 andd (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();
json
"gufy/cpanel-php":"~1.0"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.