Created
February 1, 2021 15:47
-
-
Save AdnanHussainTurki/1e9539e91781d75fb033222a2dbcbfde to your computer and use it in GitHub Desktop.
Documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require "../vendor/autoload.php"; | |
use myPHPnotes\cPanel; | |
// Creating Connection | |
$cPanel = new cPanel(__USERNAME__,__PASSWORD__, __HOST__); | |
// List Domains | |
$result = ($cPanel->execute('uapi', 'DomainInfo', 'list_domains')); | |
// Create Sub-Domain | |
$parameters = [ | |
'domain' => "adnan", | |
'rootdomain' => "myphpnotes.com", | |
'dir' => "/home/username/public_html/sub/adnan", | |
'disallowdot' => '1', | |
]; | |
$result = $cPanel->execute('api2', 'SubDomain', 'addsubdomain', $parameters); | |
// List Emails | |
$result = ($cPanel->execute('uapi', 'Email', 'list_pops')); | |
// Add Email | |
$parameters = [ | |
'email' => "adnan", | |
'password' => "securepasswordfortheemailpop", | |
'domain' => "myphpnotes.com", | |
'quota' => "120" //in MB, 0 for unlimited | |
]; | |
$result = $cPanel->execute('uapi', 'Email', 'add_pop', $parameters); | |
// Delete Email | |
$parameters = [ | |
'email' => "adnan", | |
'domain' => "myphpnotes.com", | |
]; | |
$result= ($cPanel->execute('uapi', 'Email', 'delete_pop', $parameters)); | |
// List Databases (Using API 2) | |
$result = $cPanel->execute('api2', 'MysqlFE', 'listdbs'); //Response structure is diff. from UAPI response | |
// Create Database | |
$parameters = [ | |
'name' => "prefix_database_name", | |
]; | |
$result = ($cPanel->execute('uapi', 'Mysql', 'create_database', $parameters)); | |
// Delete Database | |
$parameters = [ | |
'name' => "prefix_database_name", | |
]; | |
$result = ($cPanel->execute('uapi', 'Mysql', 'delete_database', $parameters)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment