[ API ] have a way to create mysql database external ?

waldemarlima

Verified User
Joined
Jul 17, 2020
Messages
11
hello everyone !! i have a directadmin reseller account .
i would like to create a database external using API , how can i proceed ?
 
thanks by you answer !
when i run script below , dont happens nothing ... :(

Code:
<?php

include 'httpsocket.php';

$dbuser = "myreseller_exemplo3";
$dbname = "myreseller_exemplo3";
$dbpass = "ZMDgOxxxxx";

$sock = new HTTPSocket;

$sock->connect('https://localhost',2222);
$sock->set_login('myreseller','mypassword');

$sock->set_method('POST');

$sock->query('/CMD_API_DATABASES',
        array(
                'action' => 'Create',
                'name' => $dbname,
                'user' => $dbuser,
                'passwd' => $dbpass,
                'passwd2' => $dbpass,
    ));

$result = $sock->fetch_body();

echo "result = ".$result; // return empty ...

?>

what am I doing wrong ?
 
Are you changing the host, username and password pin the script being run? You need to include the reseller or admin credentials for this to work. Also please note you have a password cited in the details you gave.
 
Are you changing the host, username and password pin the script being run? You need to include the reseller or admin credentials for this to work. Also please note you have a password cited in the details you gave.

Yes , i am change username and password here
$sock->set_login('myreseller','mypassword');

is there any way to print the error of this script?

when i call
echo "result = ".$result; // return empty ...
return blank answer
 
thanks for the personal help, I updated httpsocket.php to the latest version and it worked!

version that was using : httpsocket.php v2.7.2
I updated to the version : httpsocket.php v3.0.4
 
Back
Top