PHP code example of neoistone / cpanel-sdk-php
1. Go to this page and download the library: Download neoistone/cpanel-sdk-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/ */
neoistone / cpanel-sdk-php example snippets
composer
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$domain = $_GET['domain'];
$email = $_GET['email'];
$package = $_GET['package'];
$data = array();
$data['domain'] = $domain;
$data['email'] = $email;
$data['package'] = $package;
print_r($WHM->create_account($data));
name = $_GET['username'];
$WHM = new WHM( false , '1.1.1.1' , 'root' , 'pass' );
echo $WHM->login_with_user($username);
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$username = $_GET['username'];
$res = $WHM->delete_account($username);
if($res['0'] == null){
echo $res['1'];
} else {
echo 'account remove sussfully';
}
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$username = $_GET['username'];
$reson = $_GET['reson'];
echo json_encode($WHM->suspend_account($username,$reson));
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$username = $_GET['username'];
echo json_encode($WHM->unsuspend_account($username));
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$username = $_GET['username'];
$password = $_GET['password'];
echo json_encode($WHM->change_password_account($username,$password));
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$search_type = ""; // domain,username,ip,package
$search_word = ""; // example username (testuser) or ip (1.1.1.1) or domain (example.com) or package (pkg1)
echo json_encode($WHM->list_accounts($search_type,$search_word));
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$username = $_GET['username'];
$bwt = $_GET['']; //bwt in MB
echo json_encode($WHM->limit_user_bandwidth($username,$bwt));
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
echo json_encode($WHM->list_packages());
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
$username = $_GET['username'];
echo json_encode($WHM->delete_package($username));
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
echo json_encode($WHM->show_load_avg());
= new WHM( false , '1.1.1.1' , 'root' , 'pass' );
echo json_encode($WHM->get_host_name());