php中的异步Curl请求发出错误请求

php中的异步Curl请求发出错误请求,php,php-curl,Php,Php Curl,使用PHP7.3.14版本进行登台 不适用于生产环境PHP 7.1.12 Curl调用响应是400个错误请求。 我的代码 收到响应错误请求400 $url = $this->_CI->config->item('app_base_url') . $uri; $curl = curl_init($url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'ABODE-API-KE

使用PHP7.3.14版本进行登台 不适用于生产环境PHP 7.1.12 Curl调用响应是400个错误请求。 我的代码

收到响应错误请求400

$url = $this->_CI->config->item('app_base_url') . $uri;
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            'ABODE-API-KEY:' . $this->_key,
          //  'Cookie:' . $this->_CI->input->get_request_header('Cookie', true),
          //  'X-Device-Id:' . $this->_CI->input->get_request_header($this->_CI->config->item('cookie_device_id_name'), true)
        ));
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_TIMEOUT, 1);
        //curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

        if ($method == 'post') {
            curl_setopt($curl, CURLOPT_POST, true);
        } else if ($method == 'put') {
            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
        } else if ($method == 'delete')
            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
        else if ($method == 'patch') {
            curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
        } else
            curl_setopt($curl, CURLOPT_HTTPGET, true);

        $response = curl_exec($curl);

        if ($rollbar_log === true)
            $this->_CI->mlog->critical("Error: Response from asyn curl call URL:" . $url . "KEY:" . $this->_key . " Response:" . print_r($response, true));

        if (empty($response)) {
            $error = curl_error($curl);
            log_message('error', "Error from asyn curl call" . print_r($error, true));
            $this->_CI->mlog->critical("Error: asyn curl call " . $this->_key . " Error:" . print_r($error, true));
            curl_close($curl);
            return;
        }
        curl_close($curl);
    }