PHP WebSocket2 Library
PHP5 Library for browsing web
|
HTTP GET/POST parameters manager. More...
Public Member Functions | |
setAutoUrlEncode ($url_encode) | |
Enables or disables auto urlencode of parameter names and values. More... | |
isAutoUrlEncodeEnabled () | |
Returns true if auto urlencode of parameter names and values is enabled. More... | |
hasAttachments () | |
Returns true if any of parameters are attachments. More... | |
getParams ($param_type) | |
Returns array of parameters of specified type. More... | |
setParam ($name, $value, $get_only=false) | |
Adds new parameter or replaces parameter with same name. More... | |
hasParam ($name) | |
Returns true if parameter with specified name exists. More... | |
getParam ($name) | |
Returns parameter value by name. More... | |
removeParam ($name) | |
Removes parameter by name. More... | |
offsetExists ($offset) | |
Returns true if parameter with specified name exists. More... | |
offsetGet ($offset) | |
Returns parameter value by name. More... | |
offsetSet ($offset, $value) | |
Adds new parameter or replaces parameter with same name. More... | |
offsetUnset ($offset) | |
Removes parameter by name. More... | |
getRawFileData (HttpSocket $socket, $boundary) | |
Writes raw file data of attachments to socket. Moreover, writes ending boundary for multipart/form-data request. More... | |
getRawFileDataLength ($boundary) | |
Returns length in bytes of raw file data of attachments. More... | |
getRawParamString ($param_type, $boundary=null) | |
Returns raw parameter names and values string, which is ready to be sent to socket. More... | |
Data Fields | |
const | ALL_PARAMS = 0 |
All parameter types. More... | |
const | GET_ONLY_PARAMS = 1 |
Parameters that will be passed to server with GET method only. More... | |
const | NON_GET_ONLY_PARAMS = 2 |
Parameters that will be passed to server with POST/PUT method only. More... | |
HTTP GET/POST parameters manager.
By default, auto urlencode of parameter names and values is enabled.
getParam | ( | $name | ) |
Returns parameter value by name.
string | $name | Parameter name |
mixed | Parameter value or null, if no parameter found |
getParams | ( | $param_type | ) |
Returns array of parameters of specified type.
int | $param_type | Parameter type. See ALL_PARAMS, GET_ONLY_PARAMS, NON_GET_ONLY_PARAMS |
Array | Array of parameters, where keys are parameter names and values are parameter values. |
getRawFileData | ( | HttpSocket | $socket, |
$boundary | |||
) |
Writes raw file data of attachments to socket. Moreover, writes ending boundary for multipart/form-data request.
Call this function only after getRawParamString and in case param manager has any attachments.
HttpSocket | $socket | Socket to write data to |
string | $boundary | HTTP boundary. Must be the same as supplied to getRawParamString function |
getRawFileDataLength | ( | $boundary | ) |
Returns length in bytes of raw file data of attachments.
string | $boundary | HTTP boundary |
int | Length in bytes of raw file data of attachments |
getRawParamString | ( | $param_type, | |
$boundary = null |
|||
) |
Returns raw parameter names and values string, which is ready to be sent to socket.
Does not include attachments. If any attachments are present, getRawFileData must be called after getRawParamString to send all file data of attachments.
int | $param_type | Parameter type. See ALL_PARAMS, GET_ONLY_PARAMS, NON_GET_ONLY_PARAMS |
string | $boundary | Parameter boundary. Boundary is used if any attachments are present. If $param_type is GET_ONLY_PARAMS or there are no attachments, boundary can be null |
string | Raw parameter string ready to be used in any HTTP request |
hasAttachments | ( | ) |
Returns true if any of parameters are attachments.
bool | True if any of parameters are attachments |
hasParam | ( | $name | ) |
Returns true if parameter with specified name exists.
string | $name | Parameter name |
bool | True if parameter with specified name exists |
isAutoUrlEncodeEnabled | ( | ) |
Returns true if auto urlencode of parameter names and values is enabled.
bool | True if auto urlencode of parameter names and values is enabled |
offsetExists | ( | $offset | ) |
Returns true if parameter with specified name exists.
Overload for ArrayAccess interface.
string | $offset | Parameter name |
bool | True if parameter with specified name exists |
offsetGet | ( | $offset | ) |
Returns parameter value by name.
Overload for ArrayAccess interface.
string | $offset | Parameter name |
mixed | Parameter value or null, if no parameter found |
offsetSet | ( | $offset, | |
$value | |||
) |
Adds new parameter or replaces parameter with same name.
Overload for ArrayAccess interface.
string | $offset | Parameter name |
mixed | $value | Parameter value. This can be string, int, float, bool or HttpAttachment or Array of strings, int's, float's, bool's and/or HttpAttachment's |
offsetUnset | ( | $offset | ) |
Removes parameter by name.
If no parameter found, does nothing.
Overload for ArrayAccess interface.
string | $offset | Parameter name |
removeParam | ( | $name | ) |
Removes parameter by name.
If no parameter found, does nothing.
string | $name | Parameter name |
setAutoUrlEncode | ( | $url_encode | ) |
Enables or disables auto urlencode of parameter names and values.
bool | $url_encode | True to enable auto urlencode of parameter names and values |
setParam | ( | $name, | |
$value, | |||
$get_only = false |
|||
) |
Adds new parameter or replaces parameter with same name.
string | $name | Parameter name |
mixed | $value | Parameter value. This can be string, int, float, bool or HttpAttachment or Array of strings, int's, float's, bool's and/or HttpAttachment's |
bool | $get_only | If true, this parameter will be passed only with GET method. |
const ALL_PARAMS = 0 |
All parameter types.
Used in getParams, getRawParamString
const GET_ONLY_PARAMS = 1 |
Parameters that will be passed to server with GET method only.
Used in getParams, getRawParamString
const NON_GET_ONLY_PARAMS = 2 |
Parameters that will be passed to server with POST/PUT method only.
Used in getParams, getRawParamString