public function setAuth($username, $password, $auth_type = null)
    {
        if (is_null($auth_type)) {
            $auth_type = CURLAUTH_BASIC;
        }

        $this->curl_opts[CURLOPT_HTTPAUTH] = $auth_type;
        $this->curl_opts[CURLOPT_USERPWD] = "{$username}:{$password}";
    }