PHP code example of zanysoft / cpanel-api

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

    

zanysoft / cpanel-api example snippets


  
    $cpanel = App::make('cpanel');
    $cpanel->setHost($host_ip);
    $cpanel->setAuth($username, $password)
    return $cpanel->api2($user, $module, $function, $args = array());

	

	$accounts = $cpanel->listaccts();
	// passing parameters
	$accounts = $cpanel->listaccts($searchtype, $search);
	

	
	
	// createSubdomain(Domain Name, Username, Dubdomain Directory, Main Domain)
         $cpanel->createSubdomain('subdomain', 'username', '/public_html/subdomain', 'example.com')

	
	
	return $cpanel->api2($user, $module, $function, $args = array());

	
	
	return $cpanel->api1($user, $module, $function, $args = array());