From bf930521de2e8c8a68491232301cd0e4f9773bd0 Mon Sep 17 00:00:00 2001 From: MAIKS1900 Date: Wed, 7 Aug 2024 12:16:38 +0300 Subject: [PATCH] curl_close must be called before curl_close --- src/OpenAi.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OpenAi.php b/src/OpenAi.php index 87bfcbe..d27abf0 100644 --- a/src/OpenAi.php +++ b/src/OpenAi.php @@ -1003,6 +1003,7 @@ private function sendRequest(string $url, string $method, array $opts = []) curl_setopt_array($curl, $curl_info); $response = curl_exec($curl); + $curl_error = curl_error($curl); $info = curl_getinfo($curl); $this->curlInfo = $info; @@ -1010,7 +1011,7 @@ private function sendRequest(string $url, string $method, array $opts = []) curl_close($curl); if (! $response) { - throw new Exception(curl_error($curl)); + throw new Exception($curl_error); } return $response;