Class Http
An HTTP client that inspired by jQuery Ajax
- Wei\Base
-
Wei\Http implements ArrayAccess, Countable, IteratorAggregate
public
|
|
public
mixed
|
|
public
|
|
protected
array
|
|
protected
|
|
protected
|
|
protected
mixed
|
|
public
mixed
|
|
public
null
|
|
public
string
|
|
public
mixed
|
|
public
string
|
|
public
string
|
|
public
string
|
|
public
array|string
|
|
public
string|array
|
|
public
array
|
|
public
array
|
|
public
string|null
|
|
protected
array
|
|
public
boolean
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
#
getJsonObject( string $url, array $data = array() )
Execute a GET method request and parser response data to JSON object |
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
mixed
|
|
public
|
|
protected
mixed
|
#
processMethod( string $url, array $data, string $dataType, string $method )
Execute a specified method request |
public
string
|
|
public
|
|
public
boolean
|
|
public
mixed
|
|
public
|
|
public
|
|
public
integer
|
|
public
|
|
public
string
|
|
public
array
|
|
public
|
__call(),
__get(),
getOption(),
setOption()
|
protected
string
|
$url
The request URL |
|
protected
string
|
$method
The HTTP request method |
#
'GET'
|
protected
string
|
$contentType
The content type in HTTP request header |
|
protected
array
|
$cookies
A key-value array to store cookies |
#
array()
|
protected
array|string
|
$data
The data to send to the server |
#
array()
|
protected
array
|
$files
The files send to the server |
#
array()
|
protected
boolean
|
$global
Whether use the global options in |
#
false
|
protected
array
|
$headers
A key-value array to store request headers |
#
array()
|
protected
boolean
|
$header
Whether includes the header in the response string, equals the CURLOPT_HEADER option Set to true when you need to call getResponseHeaders, getResponseHeader, getResponseCookies or getResponseCookie methods |
#
false
|
protected
string
|
$ip
The IP address for the host name in URL, NOT your client IP |
|
protected
integer
|
$timeout
A number of milliseconds to wait in the whole connection |
|
protected
string
|
$dataType
The data type to parse the response body |
#
'text'
|
protected
string|true
|
$referer
The custom HTTP referer string |
|
protected
string
|
$userAgent
The custom HTTP user agent string |
|
protected
boolean
|
$throwException
Whether throw exception or keep silent when request error |
#
true
|
protected
callable
|
$beforeSend
A callback triggered after prepared the data and before the process the request |
|
protected
callable
|
$success
A callback triggered after the request is called success |
|
protected
callable
|
$error
A callback triggered when the request fails |
|
protected
callable
|
$complete
A callback triggered when request finishes (after |
|
protected
array
|
$curlOptions
The user define options for cURL handle |
#
array()
|
protected
array
|
$defaultCurlOptions
The predefined options for cURL handle |
#
array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
)
|
protected
boolean
|
$result
The request result |
|
protected
string
|
$responseText
The response body string |
|
protected
mixed
|
$response
The parsed response data |
|
protected
string
|
$responseHeader
The response header string |
|
protected
string
|
$responseHeaders
The parsed response header array |
|
protected
array
|
$responseCookies
A key-value array contains the response cookies |
|
protected
resource
|
$ch
The cURL session |
|
protected
string
|
$errorStatus
The error text status |
#
''
|
protected
|
$errorException
The error exception object |
$providers,
$wei
|