class VestaApi {
public $vst_host;
public $vst_user;
public $vst_pass;
function __construct($vst_host, $vst_user, $vst_pass){
$this->host = $vst_host;
$this->user = $vst_user;
$this->pass = $vst_pass;
}
function add_user($login, $password, $email, $package, $first_name, $last_name, $returncode = 'yes'){
$command = 'v-add-user';
'user' => $this->user,
'password' => $this->pass,
'returncode' => $returncode,
'cmd' => $command,
'arg1' => $login,
'arg2' => $password,
'arg3' => $email,
'arg4' => $package,
'arg5' => $fist_name,
'arg6' => $last_name
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function add_domain($username, $domain, $returncode = 'yes'){
$command = 'v-add-domain';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'returncode' => $returncode,
'cmd' => $command,
'arg1' => $username,
'arg2' => $domain
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function add_database($username, $db_name, $db_user, $db_pass, $returncode = 'yes'){
$command = 'v-add-database';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'returncode' => $returncode,
'cmd' => $command,
'arg1' => $username,
'arg2' => $db_name,
'arg3' => $db_user,
'arg4' => $db_pass
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function user_info($username, $format = 'json'){
$command = 'v-list-user';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'cmd' => $command,
'arg1' => $username,
'arg2' => $format
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function list_users($format = 'json'){
$command = 'v-list-users';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'cmd' => $command,
'arg1' => $format
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function user_domain_info($username, $domain, $format = 'json'){
$command = 'v-list-web-domain';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'cmd' => $command,
'arg1' => $username,
'arg2' => $domain,
'arg3' => $format
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function list_user_domains($username, $format = 'json'){
$command = 'v-list-web-domains';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'cmd' => $command,
'arg1' => $username,
'arg2' => $format
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function del_user($username, $returncode = 'yes'){
$command = 'v-delete-user';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'returncode' => $returncode,
'cmd' => $command,
'arg1' => $username
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function auth($login, $password, $returncode = 'yes'){
$command = 'v-check-user-password';
// Prepare POST query
'user' => $this->user,
'password' => $this->pass,
'cmd' => $command,
'arg1' => $username,
'arg2' => $password
);
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
function cmd($postvars){
// Send POST query via cURL
curl_setopt($curl, CURLOPT_URL
, 'https://' . $this->host . ':8083/api/');
return $answer;
}
}
?>