Create Database API - DirectAdmin PHP - Kvcodes
X

Congrats, You are Subscribed to Receive Updates.

Create Database API – DirectAdmin PHP


Introduction

Create Database using DirectAdmin PHP API. If you are working with separate VPS and installed DirectAdmin as your cpanel software and you want to create database and user with help of API for further user sales. You need this support to move on. Let’s see the API Functionality to start programming it.

DirectAdmin PHP API Code

<?php
include 'httpsocket.php';

$sock = new HTTPSocket;
$sock->connect('127.0.0.1',2222); //Your Server IP address

$sock->set_login("user","pass");
$sock->set_method('POST');

$sock->query('/CMD_API_DATABASES',
 array(
 'action' => 'create',
 'name' => "kvcodestestdb2",
 'user' => "MainUser",
 'passwd' => "Kvcodes@com",
 'passwd2' => "Kvcodes@com",
 ));

$result = $sock->fetch_body();
echo $result; ?>

Existing User

If you want to create database with existing user, the array should be like this.

 array(
 'action' => 'create',
 'name' => "kvcodestestdb2",
 'userlist' => "MainUser",
 'passwd' => "Kvcodes@com",
 'passwd2' => "Kvcodes@com",
 )

Everytime, when you create database we can create new user for each database.  If you want downloadable code, you can get it here.

Download

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, OpenCart Theme Development, PHP, HTML, CSS, jQuery, Bootstrap development and content SEO.

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar

Subscribe E-mail Updates

Congrats, You are Subscribed to Receive Updates.

Advertisement

Category Posts