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.
|
| |
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()
| ceLTIc\LTI\Http\HttpMessage::__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 ceLTIc\LTI\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
Referenced by getMethod().
◆ getMethod()
| string ceLTIc\LTI\Http\HttpMessage::getMethod |
( |
| ) |
|
Get the HTTP method for the request.
- Returns
- string Message method
References getHttpClient().
◆ getRelativeLink()
| string null ceLTIc\LTI\Http\HttpMessage::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 ceLTIc\LTI\Http\HttpMessage::getRelativeLinks |
( |
| ) |
|
Get the relative links.
- Returns
- array Associative array of relative links
◆ getUrl()
| string ceLTIc\LTI\Http\HttpMessage::getUrl |
( |
| ) |
|
Get the target URL for the request.
- Returns
- string Request URL
◆ hasRelativeLink()
| bool ceLTIc\LTI\Http\HttpMessage::hasRelativeLink |
( |
string | $rel | ) |
|
Check whether a relative link of the specified type exists.
- Parameters
-
- Returns
- bool True if it exists
◆ send()
| bool ceLTIc\LTI\Http\HttpMessage::send |
( |
| ) |
|
Send the request to the target URL.
- Returns
- bool True if the request was successful
◆ setHttpClient()
| static void ceLTIc\LTI\Http\HttpMessage::setHttpClient |
( |
?ClientInterface | $httpClient = null | ) |
|
|
static |
Set the HTTP client to use for sending the message.
- Parameters
-
| ClientInterface | null | $httpClient | |
◆ $error
| string ceLTIc\LTI\Http\HttpMessage::$error = '' |
◆ $ok
| bool ceLTIc\LTI\Http\HttpMessage::$ok = false |
True if message was processed successfully.
◆ $relativeLinks
| array ceLTIc\LTI\Http\HttpMessage::$relativeLinks = [] |
Relative links in response headers.
◆ $request
| string ceLTIc\LTI\Http\HttpMessage::$request = null |
◆ $requestHeaders
| array ceLTIc\LTI\Http\HttpMessage::$requestHeaders = [] |
◆ $response
| string ceLTIc\LTI\Http\HttpMessage::$response = null |
◆ $responseHeaders
| array ceLTIc\LTI\Http\HttpMessage::$responseHeaders = [] |
◆ $responseJson
| object array null ceLTIc\LTI\Http\HttpMessage::$responseJson = null |
◆ $status
| int ceLTIc\LTI\Http\HttpMessage::$status = 0 |
Status of response (0 if undetermined).