PHP code example of detain / myadmin-cpanel-webhosting

1. Go to this page and download the library: Download detain/myadmin-cpanel-webhosting 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/ */

    

detain / myadmin-cpanel-webhosting example snippets


use Detain\MyAdminCpanel\Plugin;

$hooks = Plugin::getHooks();
// Returns hook mappings for: settings, activate, reactivate,
// deactivate, terminate, api.register, function.

$whm = new xmlapi('your-server-ip');
$whm->set_port('2087');
$whm->set_protocol('https');
$whm->set_output('json');
$whm->hash_auth('root', $accessHash);

// List accounts
$accounts = $whm->listaccts();

// Create an account
$whm->createacct([
    'username' => 'newuser',
    'password' => 'securepass',
    'domain'   => 'example.com',
]);