CurlHelper
A trait for using cURL
Instance Methods
| Returns | Signature and Description |
|---|---|
Awaitable<string> | exec()A convenience wrapper around |
string | Gets a User-Agent string. |
Awaitable<string> | send()Does a decent job of sending off a PSR-7 request using cURL |
Method Details
exec
exec(mixed $urlOrHandle)A convenience wrapper aroundcurl_multi_await.
Pass a cURL handle, or, more simply, a string containing a URL (and the
cURL handle will be created for you), and the cURL request will be executed
via async and the string result will be retuned.
| Name | Type | Description |
|---|---|---|
$urlOrHandle | resource | string |
|
| Type | Description |
|---|---|
Awaitable<string> | An |
| Type | Conditions |
|---|---|
Unreachable | if the remote server cannot be reached |
Misconfigured | if cURL was incorrectly configured |
Unexpected | if the remote server returned an error |
getUserAgent
getUserAgent()Gets a User-Agent string.
| Type | Description |
|---|---|
string | a reasonable user-agent string |
send
send(RequestInterface $request)Does a decent job of sending off a PSR-7 request using cURL
| Name | Type | Description |
|---|---|---|
$request | RequestInterface | The request |
| Type | Description |
|---|---|
Awaitable<string> | The async response |
| Type | Conditions |
|---|---|
Unreachable | if the remote server cannot be reached |
Misconfigured | if cURL was incorrectly configured |
Unexpected | if the remote server returned an error |