Skip to content

Commit ced920d

Browse files
Fix curl_getinfo(): supplied resource is not a valid cURL handle resource (#3)
1 parent 0f7673f commit ced920d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Bot.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,10 @@ public static function sendRequest(string $method, array $parameters = [], ?stri
139139
]);
140140

141141
$response = curl_exec($ch);
142-
curl_close($ch);
143142
$response = json_decode($response, true);
143+
144144
$responseHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
145+
curl_close($ch);
145146

146147
if ($responseHttpCode !== 200) {
147148

@@ -214,7 +215,6 @@ public static function downloadFile(string $filePath, string $localFilePath)
214215
if (fwrite($localFile, fread($file, 8192), 8192) === FALSE) {
215216
return false;
216217
}
217-
218218
}
219219

220220
fclose($file);
@@ -238,7 +238,7 @@ public static function downloadFileByFileId(string $fileId, string $localFilePat
238238
]);
239239

240240
if ($file->isOk()) {
241-
241+
242242
$filePath = $file->getResult()->filePath;
243243
return self::downloadFile($filePath, $localFilePath);
244244
}

0 commit comments

Comments
 (0)