youds
Verified User
Hi
I am trying to connect with DirectAdmin via admin user/pass details and am having trouble creating a user ftp account in the process.
Please see below.
If you could point me in the right direction that would be great.
Many thanks
I am trying to connect with DirectAdmin via admin user/pass details and am having trouble creating a user ftp account in the process.
Please see below.
Code:
class DirectAdmin {
function newFtpAccount ($account, $domain, $username, $password) {
// validation
$account = addslashes($account);
$domain = addslashes($domain);
$username = addslashes($username);
$password = addslashes($password);
$sock = new HTTPSocket;
$sock->connect('***.***.***.***',2222);
$sock->set_login('admin','hidden');
$sock->set_method('POST');
$sock->query('/CMD_API_FTP', array(
'action' => 'create',
'domain' => $domain,
'user' => $username,
'type' => 'custom',
'path' => "/home/$account/domains/$domain/public_html/",
'passwd' => $password,
'passwd2' => $password
));
$result = $sock->fetch_body();
echo "<pre>";
var_dump($sock);
var_dump($result);
}
}
$directadmin = new DirectAdmin();
$directadmin->newFtpAccount('testing1', 'testing123.createwebsite.design', 'testing1-ftp', 'simplepass');
If you could point me in the right direction that would be great.
Many thanks