Hellow, at last time I start to be involved with API in DA.
I try to find a php script that add a new email account to my DA.
Anyway I search anywhere from anywhere, and that what i found.
First, I have a file that called that name httpsocket.php, that the file http://files.directadmin.com/services/all/httpsocket/httpsocket.php
I have second file that just called the above file (httpsocket.php), and this is the source:
Anyway I try to do anything, like give "777" arttibute permission, change some text in the script and search in any forum and in google.
Of courseג that I set the real parameters in the variables that need the detail.
I really need a simple sample script that add a new email account.
Thank you very much!
I try to find a php script that add a new email account to my DA.
Anyway I search anywhere from anywhere, and that what i found.
First, I have a file that called that name httpsocket.php, that the file http://files.directadmin.com/services/all/httpsocket/httpsocket.php
I have second file that just called the above file (httpsocket.php), and this is the source:
PHP:
<?
$server_ip="myipaddress";
$server_login="myusername";
$server_pass="mypasswd";
$server_ssl="N";
$username=$_POST['username'];
$domain=$_POST['domain'];
$email=$_POST['email'];
$pass=$_POST['pass'];
$package=$_POST['package'];
if (isset($_POST['action']) && $_POST['action'] == "add")
{
echo "Creating user $username on server $server_ip.... <br>\n";
include 'httpsocket.php';
$sock = new HTTPSocket;
if ($server_ssl == 'Y')
{
$sock->connect("ssl://".$server_ip, 2222);
}
else
{
$sock->connect($server_ip, 2222);
}
$sock->set_login($server_login,$server_pass);
$sock->query('/CMD_API_POP',
array(
'action' => 'create',
'domain' => $domain,
'user' => $username,
'passwd' => $pass,
'quota' => $package
));
$result = $sock->fetch_parsed_body();
if ($result['error'] != "0")
{
echo "<b>Error Creating user $username on server $server_ip:<br>\n";
echo $result['text']."<br>\n";
echo $result['details']."<br></b>\n";
}
else
{
echo "User $username created on server $server_ip<br>\n";
}
exit;
}
?>
<form action="?" method="POST">
<input type=hidden name=action value="add">
Username: <input type=text name=username><br>
Domain:<input type=text name=domain><br>
Pass: <input type=password name=pass><br>
Packge: <input type=text name=package><br>
<input type="submit" name="submit" value="send" />
</form>
Anyway I try to do anything, like give "777" arttibute permission, change some text in the script and search in any forum and in google.
Of courseג that I set the real parameters in the variables that need the detail.
I really need a simple sample script that add a new email account.
Thank you very much!