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 |
http://opensource.org/licenses/bsd-license.php Simplified BSD License |
| package |
LOG_PHP_SDK |
__construct(string $url = null, string $proxy = null, array $helpers = null) : $this
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.
$thisA reference to the current instance.
__destruct() : $this
$thisA reference to the current instance.
add_header(string $key, mixed $value) : $this
string(Required) The custom HTTP header to set.
mixed(Required) The value to assign to the custom HTTP header.
$thisA reference to the current instance.
get_response_body() : string
stringThe response body.
get_response_code() : string
stringThe HTTP response code.
get_response_header(string $header = null) : string|array
string(Optional) A specific header value to return. Defaults to all headers.
string|arrayAll or selected header values.
prep_request() : resource
resourceThe 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.
\ResponseCoreA
register_streaming_read_callback(string|array|\function $callback) : $this
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|\function(Required) The callback function is called by <php:call_user_func()>, so you can pass the following values:
<li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
<li>An anonymous function (PHP 5.3+).</li></ul>
$thisA reference to the current instance.
register_streaming_write_callback(string|array|\function $callback) : $this
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|\function(Required) The callback function is called by <php:call_user_func()>, so you can pass the following values:
<li>A method to execute, passed as <code>array('ClassName', 'MethodName')</code>.</li>
<li>An anonymous function (PHP 5.3+).</li></ul>
$thisA reference to the current instance.
remove_header(string $key) : $this
string(Required) The custom HTTP header to set.
$thisA 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.<li><code>limit</code> - <code>integer</code> - 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.</li></ul>
arrayPost-processed cURL responses.
send_request(boolean $parse = false) : string
boolean(Optional) Whether to parse the response with ResponseCore or not.
stringThe resulting unparsed data from the request.
set_body(string $body) : $this
string(Required) The textual content to send along in the body of the request.
$thisA reference to the current instance.
set_credentials(string $user, string $pass) : $this
string(Required) The username to authenticate with.
string(Required) The password to authenticate with.
$thisA reference to the current instance.
set_curlopts(array $curlopts) : $this
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.
$thisA reference to the current instance.
set_method(string $method) : $this
string(Required) One of the following constants:
$thisA reference to the current instance.
set_proxy(string $proxy) : $this
string(Required) The faux-url to use for proxy settings. Takes the following format: proxy://user:pass@hostname:port
$thisA reference to the current instance.
set_read_file(string $location) : $this
string(Required) The readable location to read from.
$thisA reference to the current instance.
set_read_stream(resource $resource, integer $size = null) : $this
resource(Required) The readable resource to read from.
integer(Optional) The size of the stream to read.
$thisA reference to the current instance.
set_read_stream_size(integer $size) : $this
integer(Required) The length in bytes to read from the stream.
$thisA reference to the current instance.
set_request_url(string $url) : $this
string(Required) The URL to make the request to.
$thisA reference to the current instance.
set_seek_position(integer $position) : $this
integer(Required) The byte-position of the stream to begin reading from.
$thisA reference to the current instance.
set_useragent(string $ua) : $this
string(Required) The useragent string to use.
$thisA reference to the current instance.
set_write_file(string $location) : $this
string(Required) The writeable location to write to.
$thisA reference to the current instance.
set_write_stream(resource $resource) : $this
resource(Required) The writeable resource to write to.
$thisA 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.
\binaryBinary 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.
integerThe number of bytes written.
HTTP_GET
HTTP_POST
HTTP_PUT
HTTP_DELETE
HTTP_HEAD
request_url :
request_headers :
request_body :
response :
response_headers :
response_body :
response_code :
response_info :
curl_handle :
method :
proxy :
username :
password :
curlopts :
debug_mode :
request_class :
response_class :
useragent :
read_file :
read_stream :
read_stream_size :
read_stream_read :
write_file :
write_stream :
seek_position :
cacert_location :
ssl_verification :
registered_streaming_read_callback :
registered_streaming_write_callback :