Skip to content

curl_error must be called before curl_close - #150

Open
MAIKS1900 wants to merge 1 commit into
orhanerday:mainfrom
MAIKS1900:fix_curl_error_after_curl_close
Open

curl_error must be called before curl_close#150
MAIKS1900 wants to merge 1 commit into
orhanerday:mainfrom
MAIKS1900:fix_curl_error_after_curl_close

Conversation

@MAIKS1900

Copy link
Copy Markdown

@MAIKS1900 MAIKS1900 changed the title curl_close must be called before curl_close curl_error must be called before curl_close Aug 7, 2024
@EfrosIonelu

EfrosIonelu commented Nov 8, 2024

Copy link
Copy Markdown
...
        $curl_error = curl_error($curl);
        $info = curl_getinfo($curl);
        $this->curlInfo = $info;
        $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);

        if (!$response) {
            // Debugging output
            $debugMessage = "cURL error: " . $curl_error . PHP_EOL .
                "HTTP code: " . $httpCode . PHP_EOL .
                "Request URL: " . $url . PHP_EOL .
                "cURL info: " . print_r($info, true);

            throw new Exception($debugMessage);
        } 

--- @MAIKS1900

@riverside riverside left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works!

@maxguru

maxguru commented May 3, 2026

Copy link
Copy Markdown

I need this merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants