Class MOXMAN_Http_HttpClientRequest

InheritanceMOXMAN_Http_HttpClientRequest

This class represents the HTTP request from a MOXMAN_Http_HttpClient instance.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructs a new HTTP client request instance. MOXMAN_Http_HttpClientRequest
getHeader() Returns a specific header by name to be sent to the server. MOXMAN_Http_HttpClientRequest
getHeaders() Returns all http headers as an array. MOXMAN_Http_HttpClientRequest
getMethod() Returns the request method like get/post/head etc. MOXMAN_Http_HttpClientRequest
getUrl() Returns the URL instance containing path, host, query etc. MOXMAN_Http_HttpClientRequest
send() Sends the specified HTTP request to server and returns a HTTP response object. MOXMAN_Http_HttpClientRequest
setAuth() Sets http basic auth authentication data MOXMAN_Http_HttpClientRequest
setHeader() Sets a specific header by name to be sent to the server. MOXMAN_Http_HttpClientRequest
setLocalFile() Sets a local file path to stream as content body of request. MOXMAN_Http_HttpClientRequest
setQuery() Sets the query string to a raw string or a name/value array. MOXMAN_Http_HttpClientRequest

Method Details

__construct() public method

Constructs a new HTTP client request instance.

public void __construct ( $client, $url, $method )
$client MOXMAN_Http_HttpClient

HTTP client instance to connect to request.

$url Array

Url object that contains the host, port, path, querystring etc.

$method string

Request method head/get/post.

getHeader() public method

Returns a specific header by name to be sent to the server.

public \String/Array getHeader ( $name, $default "" )
$name string

Name of the specified header to get.

$default
return \String/Array

$value Value or multiple values if multiple headers of the same name is to be sent.

getHeaders() public method

Returns all http headers as an array.

public Array getHeaders ( )
return Array

Name/value array with all HTTP headers.

getMethod() public method

Returns the request method like get/post/head etc.

public String getMethod ( )
return String

Http request method.

getUrl() public method

Returns the URL instance containing path, host, query etc.

public Array getUrl ( )
return Array

Name/value array with url items.

send() public method

Sends the specified HTTP request to server and returns a HTTP response object.

public MOXMAN_Http_HttpClientResponse send ( $data null )
$data
return MOXMAN_Http_HttpClientResponse

HTTP client response instance.

setAuth() public method

Sets http basic auth authentication data

public void setAuth ( $user, $password )
$user string
$password string
setHeader() public method

Sets a specific header by name to be sent to the server.

public void setHeader ( $name, $value )
$name string

Name of the specified header to set.

$value \String/Array

Value or multiple values if multiple headers of the same name is to be sent.

setLocalFile() public method

Sets a local file path to stream as content body of request.

public void setLocalFile ( $localFilePath )
$localFilePath string

Local file path to send as binary stream.

setQuery() public method

Sets the query string to a raw string or a name/value array.

public \Instance setQuery ( $query )
$query \String/Array

Query string or array to set.

return \Instance

Of http request.