An open API service indexing awesome lists of open source software.

https://github.com/kdevelopement/cpanel-api-simple-php


https://github.com/kdevelopement/cpanel-api-simple-php

Last synced: 5 months ago
JSON representation

Awesome Lists containing this project

README

          

## cPanel/WHM API for PHP library
Simples API via cURL

### Function List
```php
- MYSQL
Create Database MySQL
Create User Database MySQL
Set Privileges DataBase x User
Delete Database MySQL
Delete User Database MySQL
Set Password User Database MySQL
Rename User Database MySQL
Check Database MySQL
Check Database MySQL
DUMP Database MySQL

- POSTGRESQL
Create Database PostgreSQL
Create User PostgreSQL
Set All Privileges Database x User PostgreSQL
Delete Database PostgreSQL
Delete User PostgreSQL

- QUOTA
Get Quota Local Cpanel
Get Quota Info Cpanel

- SERVER INFO
Clear Spam Box
Get Bandwidth Account cPanel
Get Errors Log cPanel

- SUBDOMAIN
Create Subdomain

- BACKUPS
Create Full Backup FTP
Create Backup Homedir
Restaure Backup Full

- FTP CPANEL
Change FTP Quote Account
Change Password FTP Account
Delete FTP Account

- EMAIL
Create Email Account cPanel
Delete Email Account cPanel
Set Password Email Account cPanel
List Email Account User
Add Spam Filter Email Account SCORE: 8.0
Add Forwarder Email Account
Suspend Account Email
Unsuspend Account Email
Verify Password Account Email
Trace Delivery Email
Get Quote Account Email cPanel
Get Spam Filter Email cPanel

- DOMAINS
List Domains cPanel User Account
List Domains Data cPanel User Account
Get Data Domain cPanel User Account

- TOKEN CPANEL
Create New Token
TIME: 6 = 6 Hours
Revoke Token cPanel

- GET USAGES CPANEL ACCOUNT

- GET RESELLERS CPANEL ACCOUNT

- SET LOCALE CPANEL

- EMPTY TRASH ACCOUNT CPANEL

- SSL
Auto SSL cPanel Account
Auto SSL cPanel Account Problems
Auto SSL cPanel Account Excludes
Auto SSL cPanel Account Remove Excludes

- GET SIMPLE PASSWORD

- GET SECURE PASSWORD

```

## Contents
- [Installation Guide](#installation-guide)
- [Usage](#usage)
- [Functions](#functions)
- [Feedback & Contribution](#feedback-&-contribution)

### Installation Guide

Install the class in your file

require_once("cPanelApi.php");

### Usage

For example, how to call the function and connect to the cpanel account, example shows the account domains.

```php
listDataDomains();

```

### Functions

# MYSQL

Create Database MySQL

```php
createDataBaseMySQL("DATABASENAME");

```

Create User Database MySQL

```php
createUserMySQL("USERDB", "PASSWORD");

```

Set Privileges DataBase x User

```php
setPrivilegesMySQL("DATABASENAME", "USERDB");

```

Delete Database MySQL

```php
deleteDataBaseMySQL("DATABASENAME");

```

Delete User Database MySQL

```php
deleteUserMySQL("USERDB");

```

Set Password User Database MySQL

```php
setPasswordUserMySQL("USERDB", "NEWPASSWORD");

```

Rename User Database MySQL

```php
renameUserMySQL("USERDB", "NEWUSERDB");

```

Check Database MySQL

```php
checkDataBaseMySQL("DATABASENAME");

```

Check Database MySQL

```php
checkDataBaseMySQL("DATABASENAME");

```

DUMP Database MySQL

```php
dumpDataBaseMySQL("DATABASENAME");

```

# POSTGRESQL

Create Database PostgreSQL

```php
createDataBasePostgre("DATABASENAME");

```

Create User PostgreSQL

```php
createUserPostgre("USERDB", "PASSWORD");

```

Set All Privileges Database x User PostgreSQL

```php
allPrivilegesPostgre("USERDB", "DATABASENAME");

```

Delete Database PostgreSQL

```php
deleteDataBasePostgre("DATABASENAME");

```

Delete User PostgreSQL

```php
deleteUserPostgre("USERDB");

```

# QUOTA

Get Quota Local Cpanel

```php
getLocalQuota();

```

Get Quota Info Cpanel

```php
getInfoQuota();

```

# SERVER INFO

Clear Spam Box

```php
clearSpamBox();

```

Get Bandwidth Account cPanel

```php
getBandwidth();

```

Get Errors Log cPanel

```php
getErrors();

```

# SUBDOMAIN

Create Subdomain
The subdomain's document root within the home directory.
This value defaults to the user's home directory /public_html/ path

```php
createSubdomain("SUBDOMAIN", "PATH");

```

# BACKUPS

Create Full Backup FTP

This function creates a full backup to the remote server via File Transfer Protocol (FTP). The system creates a file in the backup-MM.DD.YYYY_HH-mm-ss.tar.gz filename format.
FTPDOMAIN A valid hostname or IP address.
The email address to receive a confirmation email when the backup completes.

```php
ftpBackupFull("FTPUSER", "FTPPASSWORD", "FTPDOMAIN", "EMAIL");

```
Create Backup Homedir

This function creates a full backup to the user's home directory. The system creates a file in the backup-MM.DD.YYYY_HH-mm-ss_username.tar.gz filename format.

```php
createBackup();

```
Restaure Backup Full

The directory to which to restore the file.
This parameter defaults to the user's /home directory.
The full directory path for a cPanel account.
FILEDIR Example: /home/cpuser/backup_cpuser_9-10-2100.tar.gz

```php
restaureBackup("FILEDIR");

```

# FTP CPANEL

Create Account FTP cPanel
QUOTA - 0 for Unlimited, 500 = 500mb

```php
ftpCreate("USERFTP", "PASSWORDFTP", "QUOTA");

```

Update homedir FTP Account
The FTP account's home directory.

This parameter defaults to the user@domain subdirectory in the cPanel account's home directory with the name, where user and domain represent the user and domain parameters.

A relative path from the cPanel account's home directory. example1/

```php
ftpHomeDir("USERFTP", "HOMEDIR");

```

Change FTP Quote Account

```php
ftpQuota("USERFTP", "1000");

```

Change Password FTP Account

```php
ftpSetPassword("USERFTP", "NEWPASSWORD");

```

Delete FTP Account

```php
ftpDelete("USERFTP");

```

# EMAIL

Create Email Account cPanel

The email account username or address.
A valid email account username. For example, user to create.
Example: user

```php
createEmail("USERMAIL", "PASSWORD", "QUOTA");

```

Delete Email Account cPanel

```php
deleteEmail("USERMAIL");

```

Set Password Email Account cPanel

```php
setPasswordEmail("USERMAIL", "NEWPASSWORD");

```

List Email Account User

```php
listEmail("user");

```

Add Spam Filter Email Account
SCORE: 8.0

```php
addSpamFilter("user@domain.com", "SCORE");

```

Add Forwarder Email Account

```php
addForwarder("user", "emailforwarder@domain.com");

```

Suspend Account Email

```php
suspendEmail("user@domain.com");

```

Unsuspend Account Email

```php
unsuspendEmail("user@domain.com");

```

Verify Password Account Email

```php
verifyPasswordEmail("user@domain.com", "PASSWORD");

```

Trace Delivery Email

```php
traceDeliveryEmail("email@example.com");

```

Get Quote Account Email cPanel

```php
quotaEmail("user@domain.com");

```

Get Spam Filter Email cPanel

```php
getSpamSettings("user@domain.com");

```

# DOMAINS

List Domains cPanel User Account

```php
listDomains();

```

List Domains Data cPanel User Account

```php
listDataDomains();

```

Get Data Domain cPanel User Account

```php
listDataDomains("domain.com");

```

# TOKEN CPANEL

Create New Token

TIME: 6 = 6 Hours

```php
createToken("NAMETOKEN", "TIME");

```

Revoke Token cPanel

```php
revokeToken("NAMETOKEN");

```

# GET USAGES CPANEL ACCOUNT

```php
getUsages();

```

# GET RESELLERS CPANEL ACCOUNT

```php
getResellers();

```

# SET LOCALE CPANEL

```php
setLocale("en");

```

# SET LOCALE CPANEL
https://www.iso.org/iso-3166-country-codes.html

```php
setLocale("en");

```

# EMPTY TRASH ACCOUNT CPANEL

```php
emptyTrash("31");

```

# SSL

Auto SSL cPanel Account

```php
autoSSL();

```

Auto SSL cPanel Account Problems

```php
autoSSLProblems();

```

Auto SSL cPanel Account Excludes

```php
autoSSLExclude("domain.com");

```

Auto SSL cPanel Account Remove Excludes

```php
autoSSLRemoveExclude("domain.com");

```

# GET SIMPLE PASSWORD

```php
simple_password();

```

# GET SECURE PASSWORD

```php
secure_password();

```

#### Defining Configuration on constructor
This is the example when you want to define your configuration while creating new object

```php