Class to represent an HTTP message request. More...
Public Member Functions | |
| __construct ($url, $method='GET', $params=null, $header=null) | |
| Class constructor. | |
| getUrl () | |
| Get the target URL for the request. | |
| getMethod () | |
| Get the HTTP method for the request. | |
| send () | |
| Send the request to the target URL. | |
| hasRelativeLink ($rel) | |
| Check whether a relative link of the specified type exists. | |
| getRelativeLink ($rel) | |
| Get the URL from the relative link with the specified type. | |
| getRelativeLinks () | |
| Get the relative links. | |
Static Public Member Functions | |
| static | setHttpClient ($httpClient=null) |
| Set the HTTP client to use for sending the message. | |
| static | getHttpClient () |
| Get the HTTP client to use for sending the message. | |
Data Fields | |
| $ok = false | |
| True if message was processed successfully. | |
| $request = null | |
| Request body. | |
| $requestHeaders = '' | |
| Request headers. | |
| $response = null | |
| Response body. | |
| $responseHeaders = '' | |
| Response headers. | |
| $relativeLinks = array() | |
| Relative links in response headers. | |
| $status = 0 | |
| Status of response (0 if undetermined). | |
| $error = '' | |
| Error message. | |
Class to represent an HTTP message request.
Definition at line 14 of file HttpMessage.php.
| __construct | ( | $url, | |
$method = 'GET', |
|||
$params = null, |
|||
$header = null |
|||
| ) |
Class constructor.
| 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) |
Reimplemented in HTTPMessage.
Definition at line 102 of file HttpMessage.php.
|
static |
Get the HTTP client to use for sending the message.
If one is not set, a default client is created.
Definition at line 152 of file HttpMessage.php.
References Util\logDebug().
Referenced by HttpMessage\send().
| getMethod | ( | ) |
Get the HTTP method for the request.
Definition at line 131 of file HttpMessage.php.
Referenced by CurlClient\send(), and StreamClient\send().
| getRelativeLink | ( | $rel | ) |
Get the URL from the relative link with the specified type.
| string | $rel |
Definition at line 238 of file HttpMessage.php.
References HttpMessage\hasRelativeLink().
| getRelativeLinks | ( | ) |
Get the relative links.
Definition at line 253 of file HttpMessage.php.
References HttpMessage\$relativeLinks.
| getUrl | ( | ) |
Get the target URL for the request.
Definition at line 121 of file HttpMessage.php.
Referenced by CurlClient\send(), and StreamClient\send().
| hasRelativeLink | ( | $rel | ) |
Check whether a relative link of the specified type exists.
| string | $rel |
Definition at line 226 of file HttpMessage.php.
Referenced by HttpMessage\getRelativeLink().
| send | ( | ) |
Send the request to the target URL.
Definition at line 173 of file HttpMessage.php.
References Util\$logLevel, HttpMessage\$ok, HttpMessage\getHttpClient(), Util\logError(), Util\logInfo(), and Util\LOGLEVEL_NONE.
|
static |
Set the HTTP client to use for sending the message.
| ClientInterface | null | $httpClient |
Definition at line 141 of file HttpMessage.php.
References Util\logDebug().
| string $error = '' |
Error message.
Definition at line 71 of file HttpMessage.php.
| bool $ok = false |
True if message was processed successfully.
Definition at line 22 of file HttpMessage.php.
Referenced by HttpMessage\send().
| array $relativeLinks = array() |
Relative links in response headers.
Definition at line 57 of file HttpMessage.php.
Referenced by HttpMessage\getRelativeLinks().
| string null $request = null |
Request body.
Definition at line 29 of file HttpMessage.php.
| string array $requestHeaders = '' |
Request headers.
Definition at line 36 of file HttpMessage.php.
| string null $response = null |
Response body.
Definition at line 43 of file HttpMessage.php.
| string array $responseHeaders = '' |
Response headers.
Definition at line 50 of file HttpMessage.php.
| int $status = 0 |
Status of response (0 if undetermined).
Definition at line 64 of file HttpMessage.php.