Class to represent an HTTP message request.
More...
|
| | __construct (string $url, string $method="GET", array|string|null $params=null, array|string|null $header=null) |
| | Class constructor.
|
| string | getUrl () |
| | Get the target URL for the request.
|
| string | getMethod () |
| | Get the HTTP method for the request.
|
| bool | send () |
| | Send the request to the target URL.
|
| bool | hasRelativeLink (string $rel) |
| | Check whether a relative link of the specified type exists.
|
| string null | getRelativeLink (string $rel) |
| | Get the URL from the relative link with the specified type.
|
| array | getRelativeLinks () |
| | Get the relative links.
|
|
|
bool | $ok = false |
| | True if message was processed successfully.
|
|
string | $request = null |
| | Request body.
|
|
array | $requestHeaders = [] |
| | Request headers.
|
|
string | $response = null |
| | Response body.
|
|
array | $responseHeaders = [] |
| | Response headers.
|
|
object array null | $responseJson = null |
| | JSON response body.
|
|
array | $relativeLinks = [] |
| | Relative links in response headers.
|
|
int | $status = 0 |
| | Status of response (0 if undetermined).
|
|
string | $error = '' |
| | Error message.
|
Class to represent an HTTP message request.
- Author
- Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com
- Copyright
- SPV Software Products
- Licence: http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3
◆ __construct()
| __construct |
( |
string | $url, |
|
|
string | $method = "GET", |
|
|
array|string|null | $params = null, |
|
|
array|string|null | $header = null ) |
Class constructor.
- Parameters
-
| string | $url | URL to send request to |
| string | $method | Request method to use (optional, default is GET) |
| array | string | null | $params | Associative array of parameter values to be passed or message body (optional, default is none) |
| array | string | null | $header | Values to include in the request header (optional, default is none) |
References Util\logDebug().
◆ getHttpClient()
Get the HTTP client to use for sending the message.
If one is not set, a default client is created.
- Returns
- ClientInterface|null The HTTP client
References Util\$logLevel.
◆ getMethod()
Get the HTTP method for the request.
- Returns
- string Message method
◆ getRelativeLink()
| string null getRelativeLink |
( |
string | $rel | ) |
|
Get the URL from the relative link with the specified type.
- Parameters
-
- Returns
- string|null The URL associated with the relative link, null if it is not defined
◆ getRelativeLinks()
| array getRelativeLinks |
( |
| ) |
|
Get the relative links.
- Returns
- array Associative array of relative links
◆ getUrl()
Get the target URL for the request.
- Returns
- string Request URL
◆ hasRelativeLink()
| bool hasRelativeLink |
( |
string | $rel | ) |
|
Check whether a relative link of the specified type exists.
- Parameters
-
- Returns
- bool True if it exists
◆ send()
Send the request to the target URL.
- Returns
- bool True if the request was successful
◆ setHttpClient()
Set the HTTP client to use for sending the message.
- Parameters
-
| ClientInterface | null | $httpClient | |