vendredi 21 février 2020

How to fix error "cURL Error #:transfer closed with outstanding read data remaining" on PHP

I try curl on php and i have curl syntax on Lumen 5.*, but if data is big can't running

        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => '',
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 60,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => 'GET',
            CURLOPT_HTTPHEADER => array(
                'Cache-Control: no-cache',
                'Content-Type: application/json',
                'Authorization: Bearer blablabla' 
            ),
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);

        if ($err) {
            echo 'cURL Error #:' . $err;
        } else {
            if ($this->isJSON($response) == False) {
                return $response;
            }
            return json_decode($response, true);
        }

but if data is big show error

cURL Error #:transfer closed with outstanding read data remaining

how to fix it?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2V5jUOm
via IFTTT

Aucun commentaire:

Enregistrer un commentaire