API Bugs add new domain
Posted: Wed Mar 09, 2016 10:08 am
Let me explain :
i have put vesta admin login details in vestacon.php and it is connecting fine.
I create a user rinkunn ok
And exampledo.com domain is not present.
I run this code:
Output:
Query returned error code: 4 ( i was expecting Domain has been successfuly created )
But this code has added this domain .
ok i reload this web page again:
Output:
Query returned error code: 4
So funny API :)
i have put vesta admin login details in vestacon.php and it is connecting fine.
I create a user rinkunn ok
And exampledo.com domain is not present.
I run this code:
Code: Select all
<?php
require("vestacon.php");
$vst_returncode = 'yes';
$vst_command = 'v-add-domain';
// New Domain
$username = "rinkunn";
$domain = "exampledo.com";
// Prepare POST query
$postvars = array(
'user' => $vst_username,
'password' => $vst_password,
'returncode' => $vst_returncode,
'cmd' => $vst_command,
'arg1' => $username,
'arg2' => $domain
);
$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";
}
Output:
Query returned error code: 4 ( i was expecting Domain has been successfuly created )
But this code has added this domain .
ok i reload this web page again:
Output:
Query returned error code: 4
So funny API :)