CurlClient
Contents
Description #
Source #
Methods #
- __construct — CurlClient constructor.
- __destruct
- canSafelyUseHttp2 — Indicates whether it is safe to use HTTP/2 or not.
- closeCurlHandle — Closes the curl handle if initialized. Do nothing if already closed.
- constructRequest
- executeRequestWithRetries
- executeStreamingRequestWithRetries — Like `executeRequestWithRetries` except: 1. Does not buffer the body of a successful (status code < 300) response into memory -- instead, calls the caller-provided $readBodyChunk with each chunk of incoming data.
- getConnectTimeout
- getDefaultOptions
- getEnableHttp2
- getEnablePersistentConnections
- getRequestStatusCallback
- getTimeout
- getUserAgentInfo
- handleCurlError
- hasHeader — Checks if a list of headers contains a specific header name.
- initCurlHandle — Initializes the curl handle. If already initialized, the handle is closed first.
- initUserAgentInfo
- instance
- parseLineIntoHeaderArray
- request
- requestStream
- resetCurlHandle — Resets the curl handle. If the handle is not already initialized, or if persistent connections are disabled, the handle is reinitialized instead.
- setConnectTimeout
- setEnableHttp2
- setEnablePersistentConnections
- setRequestStatusCallback — Sets a callback that is called after each request. The callback will receive the following parameters: string $rbody The response body integer $rcode The response status code \Stripe\Util\CaseInsensitiveArray $rheaders The response headers integer $errno The curl error number string|null $message The curl error message boolean $shouldRetry Whether the request will be retried integer $numRetries The number of the retry attempt .
- setTimeout
- shouldRetry — Checks if an error is a problem that we should retry on. This includes both socket errors that may represent an intermittent problem and some special HTTP statuses.
- sleepTime — Provides the number of seconds to wait before retrying a request.
- useHeadersToDetermineWriteCallback — Curl permits sending \CURLOPT_HEADERFUNCTION, which is called with lines from the header and \CURLOPT_WRITEFUNCTION, which is called with bytes from the body. You usually want to handle the body differently depending on what was in the header.