HTTP_GET
HTTP_GET
GET HTTP Method
Handles all HTTP requests using cURL and manages the responses.
__construct(string $url = null, string $proxy = null, array $helpers = null) : $this
Constructs a new instance of this class.
string | $url | (Optional) The URL to request or service endpoint to query. |
string | $proxy | (Optional) The faux-url to use for proxy settings. Takes the following format: |
array | $helpers | (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class. |
A reference to the current instance.
set_curlopts(array $curlopts) : $this
Set additional CURLOPT settings. These will merge with the default settings, and override if there is a duplicate.
array | $curlopts | (Optional) A set of key-value pairs that set |
A reference to the current instance.
set_read_stream(resource $resource, integer $size = null) : $this
Sets the resource to read from while streaming up. Reads the stream from its current position until EOF or `$size` bytes have been read. If `$size` is not given it will be determined by <php:fstat()> and <php:ftell()>.
resource | $resource | (Required) The readable resource to read from. |
integer | $size | (Optional) The size of the stream to read. |
A reference to the current instance.
register_streaming_read_callback(string|array|\OSS\Http\function $callback) : $this
Register a callback function to execute whenever a data stream is read from using <CFRequest::streaming_read_callback()>.
The user-defined callback function should accept three arguments:
$curl_handle
- resource
- Required - The cURL handle resource that represents the in-progress transfer.$file_handle
- resource
- Required - The file handle resource that represents the file on the local file system.$length
- integer
- Required - The length in kilobytes of the data chunk that was transferred.string|array|\OSS\Http\function | $callback | (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values:
|
A reference to the current instance.
register_streaming_write_callback(string|array|\OSS\Http\function $callback) : $this
Register a callback function to execute whenever a data stream is written to using <CFRequest::streaming_write_callback()>.
The user-defined callback function should accept two arguments:
$curl_handle
- resource
- Required - The cURL handle resource that represents the in-progress transfer.$length
- integer
- Required - The length in kilobytes of the data chunk that was transferred.string|array|\OSS\Http\function | $callback | (Required) The callback function is called by <php:call_user_func()>, so you can pass the following values:
|
A reference to the current instance.
streaming_read_callback(resource $curl_handle, resource $file_handle, integer $length) : \OSS\Http\binary
A callback function that is invoked by cURL for streaming up.
resource | $curl_handle | (Required) The cURL handle for the request. |
resource | $file_handle | (Required) The open file handle resource. |
integer | $length | (Required) The maximum number of bytes to read. |
Binary data from a stream.
streaming_write_callback(resource $curl_handle, \OSS\Http\binary $data) : integer
A callback function that is invoked by cURL for streaming down.
resource | $curl_handle | (Required) The cURL handle for the request. |
\OSS\Http\binary | $data | (Required) The data to write. |
The number of bytes written.
process_response(resource $curl_handle = null, string $response = null) : \OSS\Http\ResponseCore
Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the data stored in the `curl_handle` and `response` properties unless replacement data is passed in via parameters.
resource | $curl_handle | (Optional) The reference to the already executed cURL request. |
string | $response | (Optional) The actual response content itself that needs to be parsed. |
A
send_request(boolean $parse = false) : string
Sends the request, calling necessary utility functions to update built-in properties.
boolean | $parse | (Optional) Whether to parse the response with ResponseCore or not. |
The resulting unparsed data from the request.