PHP code example of aminireza-ir / cpanel

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

    

aminireza-ir / cpanel example snippets




rc\Methods;

$cpanel = new Methods([
    'host' => '127.0.0.1',
    'api_key' => 'LKACN0OGIWFVOO5FNYNVZX2NOYOP7GWO',
    'username' => 'root',
    'port' => 2087,
]);

echo $cpanel->SendWithArray('Bandwidth', 'getbwdata', 'username');




$cpanel = new Methods([
    'host' => '127.0.0.1',
    'password' => '!password1234',
    'username' => 'root',
    'port' => 2087,
]);




$cpanel->SendWithArray('Cron', 'add_line', 'user', [
    'command' => '/usr/bin/perl%20/home/username/happynewyear.pl',
    'day' => 1,
    'hour' => 0,
    'minute' => 0,
    'month' => 1,
    'weekday' => '*'
]);