Squiz Matrix
4.12.2
|
Public Member Functions | |
HTTP_Request ($url= '', $params=array()) | |
_generateHostHeader () | |
reset ($url, $params=array()) | |
setURL ($url) | |
getUrl () | |
setProxy ($host, $port=8080, $user=null, $pass=null) | |
setBasicAuth ($user, $pass) | |
setMethod ($method) | |
setHttpVer ($http) | |
addHeader ($name, $value) | |
removeHeader ($name) | |
addQueryString ($name, $value, $preencoded=false) | |
addRawQueryString ($querystring, $preencoded=true) | |
addPostData ($name, $value, $preencoded=false) | |
_arrayMapRecursive ($callback, $value) | |
addFile ($inputName, $fileName, $contentType= 'application/octet-stream') | |
addRawPostData ($postdata, $preencoded=true) | |
setBody ($body) | |
clearPostData () | |
addCookie ($name, $value) | |
clearCookies () | |
sendRequest ($saveBody=true) | |
disconnect () | |
getResponseCode () | |
getResponseReason () | |
getResponseHeader ($headername=null) | |
getResponseBody () | |
getResponseCookies () | |
getEncodedPath () | |
_buildRequest () | |
_flattenArray ($name, $values) | |
attach (&$listener) | |
detach (&$listener) | |
_notify ($event, $data=null) | |
Definition at line 123 of file Request.php.
_arrayMapRecursive | ( | $callback, | |
$value | |||
) |
Recursively applies the callback function to the value
mixed | Callback function |
mixed | Value to process private |
Definition at line 573 of file Request.php.
_buildRequest | ( | ) |
Builds the request string
private
Definition at line 960 of file Request.php.
_flattenArray | ( | $name, | |
$values | |||
) |
Helper function to change the (probably multidimensional) associative array into the simple one.
string | name for item |
mixed | item's values |
Definition at line 1084 of file Request.php.
_generateHostHeader | ( | ) |
Generates a Host header for HTTP/1.1 requests
private
Definition at line 373 of file Request.php.
_notify | ( | $event, | |
$data = null |
|||
) |
Notifies all registered listeners of an event.
string | Event name |
mixed | Additional data private |
Definition at line 1160 of file Request.php.
addCookie | ( | $name, | |
$value | |||
) |
Appends a cookie to "Cookie:" header
string | $name | cookie name |
string | $value | cookie value public |
Definition at line 665 of file Request.php.
addFile | ( | $inputName, | |
$fileName, | |||
$contentType = 'application/octet-stream' |
|||
) |
Adds a file to form-based file upload
Used to emulate file upload via a HTML form. The method also sets Content-Type of HTTP request to 'multipart/form-data'.
If you just want to send the contents of a file as the body of HTTP request you should use setBody() method.
public
string | name of file-upload field |
mixed | file name(s) |
mixed | content-type(s) of file(s) being uploaded |
PEAR_Error |
Definition at line 602 of file Request.php.
addHeader | ( | $name, | |
$value | |||
) |
Adds a request header
string | Header name |
string | Header value public |
Definition at line 505 of file Request.php.
addPostData | ( | $name, | |
$value, | |||
$preencoded = false |
|||
) |
Adds postdata items
string | Post data name |
string | Post data value |
bool | Whether data is already urlencoded or not, default = not public |
Definition at line 556 of file Request.php.
addQueryString | ( | $name, | |
$value, | |||
$preencoded = false |
|||
) |
Adds a querystring parameter
string | Querystring parameter name |
string | Querystring parameter value |
bool | Whether the value is already urlencoded or not, default = not public |
Definition at line 531 of file Request.php.
addRawPostData | ( | $postdata, | |
$preencoded = true |
|||
) |
Adds raw postdata (DEPRECATED)
string | The data |
bool | Whether data is preencoded or not, default = already encoded public |
Definition at line 629 of file Request.php.
addRawQueryString | ( | $querystring, | |
$preencoded = true |
|||
) |
Sets the querystring to literally what you supply
string | The querystring data. Should be of the format foo=bar&x=y etc |
bool | Whether data is already urlencoded or not, default = already encoded public |
Definition at line 543 of file Request.php.
attach | ( | & | $listener | ) |
Adds a Listener to the list of listeners that are notified of the object's events
Events sent by HTTP_Request object
Events sent by HTTP_Response object
HTTP_Request_Listener | listener to attach |
Definition at line 1124 of file Request.php.
clearCookies | ( | ) |
Clears any cookies that have been added (DEPRECATED).
Useful for multiple request scenarios
public
Definition at line 679 of file Request.php.
clearPostData | ( | ) |
Clears any postdata that has been added (DEPRECATED).
Useful for multiple request scenarios.
public
Definition at line 653 of file Request.php.
detach | ( | & | $listener | ) |
Removes a Listener from the list of listeners
HTTP_Request_Listener | listener to detach |
Definition at line 1141 of file Request.php.
disconnect | ( | ) |
Disconnect the socket, if connected. Only useful if using Keep-Alive.
public
Definition at line 838 of file Request.php.
getEncodedPath | ( | ) |
NOTE: Not included in HTTP_Request v.1.4.4 - i.e. this is a Matrix patch
Returns encoded path
Result is properly encoded and ready for use in the request. Complies with RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax Does not modify the internal state
Code Based on work by: By Esben Maal?e esm-at-baseclass.modulweb.dk see: http://baseclass.modulweb.dk/urlvalidator
Definition at line 925 of file Request.php.
getResponseBody | ( | ) |
Returns the body of the response
public
Definition at line 892 of file Request.php.
getResponseCode | ( | ) |
Returns the response code
public
Definition at line 852 of file Request.php.
getResponseCookies | ( | ) |
Returns cookies set in response
public
Definition at line 903 of file Request.php.
getResponseHeader | ( | $headername = null | ) |
Returns either the named header or all if no name given
public
string | The header name to return, do not set to get all headers |
Definition at line 876 of file Request.php.
getResponseReason | ( | ) |
Returns the response reason phrase
public
Definition at line 863 of file Request.php.
getUrl | ( | ) |
Returns the current request URL
Definition at line 436 of file Request.php.
HTTP_Request | ( | $url = '' , |
|
$params = array() |
|||
) |
#@- Constructor
Sets up the object
string | The url to fetch/access |
array | Associative array of parameters which can have the following keys:
|
Definition at line 314 of file Request.php.
removeHeader | ( | $name | ) |
Removes a request header
string | Header name to remove public |
Definition at line 516 of file Request.php.
reset | ( | $url, | |
$params = array() |
|||
) |
Resets the object to its initial state (DEPRECATED). Takes the same parameters as the constructor.
string | $url | The url to be requested |
array | $params | Associative array of parameters (see constructor for details) public |
Definition at line 401 of file Request.php.
sendRequest | ( | $saveBody = true | ) |
Sends the request
public
bool | Whether to store response body in Response object property, set this to false if downloading a LARGE file and using a Listener |
Definition at line 692 of file Request.php.
setBasicAuth | ( | $user, | |
$pass | |||
) |
Sets basic authentication parameters
string | Username |
string | Password |
Definition at line 468 of file Request.php.
setBody | ( | $body | ) |
Sets the request body (for POST, PUT and similar requests)
string | Request body public |
Definition at line 640 of file Request.php.
setHttpVer | ( | $http | ) |
Sets the HTTP version to use, 1.0 or 1.1
string | Version to use. Use the defined constants for this public |
Definition at line 493 of file Request.php.
setMethod | ( | $method | ) |
Sets the method to be used, GET, POST etc.
string | Method to use. Use the defined constants for this public |
Definition at line 482 of file Request.php.
setProxy | ( | $host, | |
$port = 8080 , |
|||
$user = null , |
|||
$pass = null |
|||
) |
Sets a proxy to be used
string | Proxy host |
int | Proxy port |
string | Proxy username |
string | Proxy password public |
Definition at line 450 of file Request.php.
setURL | ( | $url | ) |
Sets the URL to be requested
string | The url to be requested public |
Definition at line 412 of file Request.php.