17 CURLE_COULDNT_RESOLVE_HOST,
18 CURLE_COULDNT_CONNECT,
21 CURLE_OPERATION_TIMEOUTED,
22 CURLE_HTTP_POST_ERROR,
23 CURLE_SSL_CONNECT_ERROR,
32 public static function execute($ch, $retries = 5, $closeAfterDone =
true)
35 if (curl_exec($ch) ===
false) {
36 $curlErrno = curl_errno($ch);
38 if (
false === in_array($curlErrno, self::$retriableErrorCodes,
true) || !$retries) {
39 $curlError = curl_error($ch);
41 if ($closeAfterDone) {
45 throw new \RuntimeException(sprintf(
'Curl error (code %s): %s', $curlErrno, $curlError));
51 if ($closeAfterDone) {
static execute($ch, $retries=5, $closeAfterDone=true)
Executes a CURL request with optional retries and exception on failure.
Create styles array
The data for the language used.
static $retriableErrorCodes