Class MOXMAN_Http_HttpClient

InheritanceMOXMAN_Http_HttpClient

This class wrapps in the HTTP Request and adds various useful options.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructs a new HttpClient instance. MOXMAN_Http_HttpClient
close() Closes the internal socket for the HTTP client. MOXMAN_Http_HttpClient
createFormData() Creates a new http form data instance. MOXMAN_Http_HttpClient
createRequest() Creates a new HTTP request instance for the specified path. MOXMAN_Http_HttpClient
getBufferSize() Returns the buffer size in bytes. MOXMAN_Http_HttpClient
getInputStream() Returns the input stream that the HTTP client reads data from. MOXMAN_Http_HttpClient
getLogLevel() Returns the current log level. 0 = no logging, 1 = basic logging, 2 = verbose logging. MOXMAN_Http_HttpClient
getOutputStream() Returns the output stream that the HTTP client writes data to. MOXMAN_Http_HttpClient
getReadTimeout() Returns the read data timeout. MOXMAN_Http_HttpClient
getSocketStream() Returns the clients internal socket resource. MOXMAN_Http_HttpClient
log() Logs the specified string to log function if the level is grater than 0. MOXMAN_Http_HttpClient
setInputStream() Sets the input stream resource handle. MOXMAN_Http_HttpClient
setLogFunction() Sets the log function to be called. MOXMAN_Http_HttpClient
setLogLevel() Sets the current log level. 0 = no logging, 1 = basic logging, 2 = verbose logging. MOXMAN_Http_HttpClient
setOutputStream() Sets the output stream resource handle. MOXMAN_Http_HttpClient
setReadTimeout() Sets the read data timeout. MOXMAN_Http_HttpClient

Method Details

__construct() public method

Constructs a new HttpClient instance.

public void __construct ( $host, $port 80 )
$host string

HTTP host name to connect to or URL string to grab host and port from.

$port int

Port number

close() public method

Closes the internal socket for the HTTP client.

public void close ( )
createFormData() public method

Creates a new http form data instance.

public MOXMAN_Http_HttpClientFormData createFormData ( )
return MOXMAN_Http_HttpClientFormData

Http form data instance to be send to client.

createRequest() public method

Creates a new HTTP request instance for the specified path.

public MOXMAN_Http_HttpClientRequest createRequest ( $path, $method "get" )
$path string

Path to create request instance for.

$method string

Method to send.

return MOXMAN_Http_HttpClientRequest

HTTP request instance to create.

getBufferSize() public method

Returns the buffer size in bytes.

public Int getBufferSize ( )
return Int

Number of bytes to buffer.

getInputStream() public method

Returns the input stream that the HTTP client reads data from.

public resource getInputStream ( )
return resource

Resource handle to input stream.

getLogLevel() public method

Returns the current log level. 0 = no logging, 1 = basic logging, 2 = verbose logging.

public int getLogLevel ( )
return int

Current log level.

getOutputStream() public method

Returns the output stream that the HTTP client writes data to.

public Resource getOutputStream ( )
return Resource

Resource handle to output stream.

getReadTimeout() public method

Returns the read data timeout.

public int getReadTimeout ( )
return int

Read timeout.

getSocketStream() public method

Returns the clients internal socket resource.

public resource getSocketStream ( )
return resource

Resource for internal socket.

log() public method

Logs the specified string to log function if the level is grater than 0.

public void log ( $str )
$str string

This is a description

setInputStream() public method

Sets the input stream resource handle.

public void setInputStream ( $handle )
$handle Resource

Resource handle to read data from.

setLogFunction() public method

Sets the log function to be called.

public void setLogFunction ( $func )
$func mixed

Name of function or array with instance and method name.

setLogLevel() public method

Sets the current log level. 0 = no logging, 1 = basic logging, 2 = verbose logging.

public void setLogLevel ( $level )
$level

Int Current log level.

setOutputStream() public method

Sets the output stream resource handle.

public void setOutputStream ( $handle )
$handle resource

Resource handle to write data to.

setReadTimeout() public method

Sets the read data timeout.

public void setReadTimeout ( $timeout )
$timeout

Int Read timeout.