PHP code example of cjrasmussen / cpanel-api
1. Go to this page and download the library: Download cjrasmussen/cpanel-api 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/ */
cjrasmussen / cpanel-api example snippets
use cjrasmussen\CpanelApi\CpanelApi;
$cpanel = new CpanelApi($host, $username, $token, CpanelApi::API_UAPI);
// LIST DOMAINS
$response = $cpanel->request('DomainInfo', 'list_domains');
var_dump($response);
// ADD A SUBDOMAIN TO A DOMAIN
$subdomain = [
'domain' => 'bar',
'rootdomain' => 'foo.com',
'dir' => 'bar',
];
$cpanel->request('SubDomain', 'addsubdomain', $subdomain);