1. Go to this page and download the library: Download adelynx/cpanel 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/ */
adelynx / cpanel example snippets
return array(
// should debugging statements be printed?
'debug' => true,
// The host to connect to (Eg: 127.0.0.1 or yourwebsite.com or whm.yourwebsite.com)
'host' => '127.0.0.1',
// the port to connect to
'port' => '2087',
// should be the literal strings http or https
'protocol' => 'https',
// output that should be given by the cpanel api (xml or json)
'output' => 'json',
// literal strings hash or password
'auth_type' => 'password',
// the actual password or hash
'auth' => 'your_cpanel_password or your_cpanel_hash',
// username to authenticate as
'user' => 'your_cpanel_username',
// The HTTP Client to use
'http_client' => 'curl'
);
class CpanelController extends Controller {
public function getListAccounts()
{
try {
$listaccts = array(json_decode(Cpanel::listaccts(), true));
return $listaccts;
} catch (Exception $e) {
return 'Exception: ' .$e->getMessage();
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.