Handles all HTTP requests using cURL and manages the responses.
version | 2011.06.07 |
---|---|
copyright | 2006-2011 Ryan Parman |
copyright | 2006-2010 Foleeo Inc. |
copyright | 2010-2011 Amazon.com, Inc. or its affiliates. |
copyright | 2008-2011 Contributors |
license | Simplified BSD License |
package | SLS_PHP_SDK |
__construct(string $url= null
, string $proxy= null
, array $helpers= null
) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Optional) The URL to request or service endpoint to query.
string
(Optional) The faux-url to use for proxy settings. Takes the following format: proxy://user:pass@hostname:port
array
(Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.
\RequestCore
A reference to the current instance.__destruct() : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
\RequestCore
A reference to the current instance.add_header(string $key, mixed $value) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The custom HTTP header to set.
mixed
(Required) The value to assign to the custom HTTP header.
\RequestCore
A reference to the current instance.get_response_body() : string
string
The response body.get_response_code() : string
string
The HTTP response code.get_response_header(string $header = null
) : string | array
string
(Optional) A specific header value to return. Defaults to all headers.
string
array
All or selected header values.prep_request() : resource
resource
The handle for the cURL object.process_response(resource $curl_handle= null
, string $response= null
) : \ResponseCore
resource
(Optional) The reference to the already executed cURL request.
string
(Optional) The actual response content itself that needs to be parsed.
\ResponseCore
A register_streaming_read_callback(string|array|\function $callback) : \RequestCore
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.fluent | This method is part of a fluent interface and will return the same instance |
---|
string
array
\function
(Required) The callback function is called by
The name of a global function to execute, passed as a string.
A method to execute, passed as array('ClassName', 'MethodName')
.
An anonymous function (PHP 5.3+).
\RequestCore
A reference to the current instance.register_streaming_write_callback(string|array|\function $callback) : \RequestCore
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.fluent | This method is part of a fluent interface and will return the same instance |
---|
string
array
\function
(Required) The callback function is called by
The name of a global function to execute, passed as a string.
A method to execute, passed as array('ClassName', 'MethodName')
.
An anonymous function (PHP 5.3+).
\RequestCore
A reference to the current instance.remove_header(string $key) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The custom HTTP header to set.
\RequestCore
A reference to the current instance.send_multi_request(array $handles, array $opt = null
) : array
array
(Required) An indexed array of cURL handles to process simultaneously.
array
(Optional) An associative array of parameters that can have the following keys:
callback
- string|array
- Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the [0]
index is the class and the [1]
index is the method name.
limit
- integer
- Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.
array
Post-processed cURL responses.send_request(boolean $parse = false
) : string
boolean
(Optional) Whether to parse the response with ResponseCore or not.
string
The resulting unparsed data from the request.set_body(string $body) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The textual content to send along in the body of the request.
\RequestCore
A reference to the current instance.set_credentials(string $user, string $pass) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The username to authenticate with.
string
(Required) The password to authenticate with.
\RequestCore
A reference to the current instance.set_curlopts(array $curlopts) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
array
(Optional) A set of key-value pairs that set CURLOPT
options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the CURLOPT_*
constants, not strings.
\RequestCore
A reference to the current instance.set_method(string $method) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) One of the following constants:
\RequestCore
A reference to the current instance.set_proxy(string $proxy) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The faux-url to use for proxy settings. Takes the following format: proxy://user:pass@hostname:port
\RequestCore
A reference to the current instance.set_read_file(string $location) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The readable location to read from.
\RequestCore
A reference to the current instance.set_read_stream(resource $resource, integer $size = null
) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
resource
(Required) The readable resource to read from.
integer
(Optional) The size of the stream to read.
\RequestCore
A reference to the current instance.set_read_stream_size(integer $size) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
integer
(Required) The length in bytes to read from the stream.
\RequestCore
A reference to the current instance.set_request_url(string $url) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The URL to make the request to.
\RequestCore
A reference to the current instance.set_seek_position(integer $position) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
integer
(Required) The byte-position of the stream to begin reading from.
\RequestCore
A reference to the current instance.set_useragent(string $ua) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The useragent string to use.
\RequestCore
A reference to the current instance.set_write_file(string $location) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
(Required) The writeable location to write to.
\RequestCore
A reference to the current instance.set_write_stream(resource $resource) : \RequestCore
fluent | This method is part of a fluent interface and will return the same instance |
---|
resource
(Required) The writeable resource to write to.
\RequestCore
A reference to the current instance.streaming_read_callback(resource $curl_handle, resource $file_handle, integer $length) : \binary
resource
(Required) The cURL handle for the request.
resource
(Required) The open file handle resource.
integer
(Required) The maximum number of bytes to read.
\binary
Binary data from a stream.streaming_write_callback(resource $curl_handle, \binary $data) : integer
resource
(Required) The cURL handle for the request.
\binary
(Required) The data to write.
integer
The number of bytes written.$cacert_location
false
$curl_handle
$curlopts
null
$debug_mode
false
$method
$password
null
$proxy
null
$read_file
null
$read_stream
null
$read_stream_read
0
$read_stream_size
null
$registered_streaming_read_callback
null
$registered_streaming_write_callback
null
$request_body
$request_class
'RequestCore'
$request_headers
$request_url
$response
$response_body
$response_class
'ResponseCore'
$response_code
$response_headers
$response_info
$seek_position
null
$ssl_verification
true
$useragent
'RequestCore/1.4.3'
$username
null
$write_file
null
$write_stream
null
HTTP_DELETE = 'DELETE'
HTTP_GET = 'GET'
HTTP_HEAD = 'HEAD'
HTTP_POST = 'POST'
HTTP_PUT = 'PUT'