- WIP on Task scheduling interface
This commit is contained in:
1 parent
586f2344df
commit
5a737c06c4
4 files changed
+26
-9
No files matched your search
+12
-5
@@ -26,15 +26,22 @@ class Curl implements TransportInterface {
|
||||
|
||||
$exec = curl_exec($ch);
|
||||
|
||||
if ( ( false === $exec ) && $this->throwErrors ) {
|
||||
$errno = curl_errno($ch);
|
||||
curl_close($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
||||
|
||||
throw new CurlException(implode(PHP_EOL, array_filter([ curl_error($ch) , static::CURL_ERROR[$errno] ?? null ])), $errno);
|
||||
if ($this->throwErrors) {
|
||||
if ( false === $exec) {
|
||||
$errno = curl_errno($ch);
|
||||
curl_close($ch);
|
||||
|
||||
throw new CurlException(implode(PHP_EOL, array_filter([ curl_error($ch) , static::CURL_ERROR[$errno] ?? null ])), $errno);
|
||||
}
|
||||
elseif ($code >= 400) {
|
||||
throw new \Exception(sprintf("HTTP code received : $code with page content : %s", $exec));
|
||||
}
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
|
||||
return $exec;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user