<?php
$username = 'XXXX'; // API User
$password = 'XXXX'; // API PW
$myusername = 'test@meine-domain.de'; //Mail User
$mypassword = 'test'; // Mail PW
$soap_location = 'https://localhost:8080/remote/index.php'; //'http://localhost:8080/ispconfig3/remote/index.php'
$soap_uri = 'https://localhost:8080/remote/'; // 'http://localhost:8080/ispconfig3/interface/web/remote/'
$client = new SoapClient(null, array('location' => $soap_location,
'uri' => $soap_uri));
try {
//* Login to the remote server
if($session_id = $client->login($username,$password)) {
echo 'Logged into remote server
sucessfully. The SessionID is '.$session_id.'
';
echo 'Logged into remote server sucessfully. The SessionID is '.$session_id.'
';
$domain_id = 1;
$client_id = 1;
$params = array(
'server_id' => 1,
'email' => '$myusername',
'login' => ''$myusername',
'password' => '$mypassword ',
'name' => 'test',
'uid' => 5000,
'gid' => 5000,
'maildir' => '/var/vmail/meine-domain.de/',
'quota' => 0,
'cc' => '',
'homedir' => '/var/vmail/',
'autoresponder' => 'n',
'autoresponder_start_date' => '',
'autoresponder_end_date' => '',
'autoresponder_text' => '',
'move_junk' => 'n',
'custom_mailfilter' => 'spam',
'postfix' => 'y',
'access' => y',
'disableimap' => 'n',
'disablepop3' => 'n',
'disabledeliver' => 'n',
'disablesmtp' => 'n'
);
$affected_rows = $client->mail_user_add($session_id, $client_id, $params);
echo "New user: ".$affected_rows."<br>";
if($client->logout($session_id)) {
echo 'Logged out.<br />';
}
} catch (SoapFault $e) {
echo $client->__getLastResponse();
die('SOAP Error: '.$e->getMessage());
}
?>