R
R
Rodion Yurchenko2015-10-13 09:25:54
PHP
Rodion Yurchenko, 2015-10-13 09:25:54

Why does Vesta always give an error?

Good afternoon
There is a server with vesta on DigitalOcean. I
use the example from the vesta api documentation to create subdomains

$postvars = array(
            'user' => $this->vst_username,
            'password' => $this->vst_password,
            'returncode' => $this->vst_returncode,
            'cmd' => 'v-add-domain',
            'arg1' => $this->username,
            'arg2' => $this->session->adding_domain // domain
        );
        $postdata = http_build_query($postvars);
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, 'https://' . $this->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);
        if($answer == 0) {
            echo "Domain has been successfuly created\n";
        } else {
            echo "Query returned error code: " .$answer. "\n";
        }

Always returns error code 4 (Object already exists)
And - in the absence of a domain - it creates it and says that the domain already exists ....
where is the error?
I'm writing on CodeIgniter if it helps the solution...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question