We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Error 4 adding (unexisting) domain with v-add-domain
-
- Posts: 4
- Joined: Fri Aug 25, 2017 1:10 pm
- Os: Ubuntu 15x
- Web: apache + nginx
Error 4 adding (unexisting) domain with v-add-domain
Hello,
I´m trying to create a domain with PHP following this guide: https://vestacp.com/docs/api/#add_domain .
In my website I ´ve created a form to fill the data and send it to the script above.
I´m getting "Query returned error code: 4" even when the domain doesn't exists.
Vesta is creating Web/DNS/Mail but returning Error.
Anybody had that yet?
thanks
My function:
I´m trying to create a domain with PHP following this guide: https://vestacp.com/docs/api/#add_domain .
In my website I ´ve created a form to fill the data and send it to the script above.
I´m getting "Query returned error code: 4" even when the domain doesn't exists.
Vesta is creating Web/DNS/Mail but returning Error.
Anybody had that yet?
thanks
My function:
Code: Select all
function cria_web($user,$endereco){
$vst_hostname = 'xxxxxxxx';
$vst_username = 'xxxxxxxx';
$vst_password = 'xxxxxxxx;
$vst_returncode = 'yes';
$vst_command = 'v-add-domain';
// New Domain
// Prepare POST query
$postvars = array(
'user' => $vst_username,
'password' => $vst_password,
'returncode' => $vst_returncode,
'cmd' => $vst_command,
'arg1' => $user,
'arg2' => $endereco
);
$postdata = http_build_query($postvars);
// Send POST query via cURL
$postdata = http_build_query($postvars);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $vst_hostname . ':8083/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$answer = curl_exec($curl);
// Check result
if($answer == 0) {
echo "Domain has been successfuly created\n";
}
else {
echo "Query returned error code: " .$answer. "\n";
}
}