Jordz2203
Verified User
- Joined
- Sep 8, 2022
- Messages
- 75
echo 'running<br>';
include 'httpsocket.php';
$dbuser = "directadminusername_dbusername";
$dbname = "directadminusername_dbname";
$dbpass = "directadminusername_dbpassword";
$sock = new HTTPSocket;
$sock->connect('za1.ccstudio.co.za',2222);
// If I remove https:// from the above link I get the following message from the echo at the bottom "use https"
// If I add https:// then no echo from below, only the above echo of "running"
$sock->set_login("adminusername|clientusername","workingadminpassword");
$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;
?>[/CODE]
For some reason the above doesn't work, I have this code on the httpsocket.php
github.com
The error is describe in the comments under the $sock->connect
EDIT: Just realized how old the reference post on this forum is https://forum.directadmin.com/threads/create-database-api.41397/
include 'httpsocket.php';
$dbuser = "directadminusername_dbusername";
$dbname = "directadminusername_dbname";
$dbpass = "directadminusername_dbpassword";
$sock = new HTTPSocket;
$sock->connect('za1.ccstudio.co.za',2222);
// If I remove https:// from the above link I get the following message from the echo at the bottom "use https"
// If I add https:// then no echo from below, only the above echo of "running"
$sock->set_login("adminusername|clientusername","workingadminpassword");
$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;
?>[/CODE]
For some reason the above doesn't work, I have this code on the httpsocket.php
DirectAdminApi/Source at master · arian/DirectAdminApi
PHP DirectAdminApi is a wrapper for the DirectAdmin Api to make the usage of the Api simple as much as possible - arian/DirectAdminApi
The error is describe in the comments under the $sock->connect
EDIT: Just realized how old the reference post on this forum is https://forum.directadmin.com/threads/create-database-api.41397/
Last edited: