PHP Class SimpleHttpRequest, simpletest

@package SimpleTest
Afficher le fichier Open project: simpletest/simpletest Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( SimpleRoute $route, SimpleFormEncoding $encoding ) Builds the socket request from the different pieces.
addHeaderLine ( string $header_line ) Adds a header line to the request.
fetch ( integer $timeout ) : SimpleHttpResponse Dispatches the content to the route's socket.
getHeaders ( ) : array Get the headers to be sent with the request.
readCookiesFromJar ( SimpleCookieJar $jar, SimpleUrl $url ) Reads all the relevant cookies from the cookie jar.

Méthodes protégées

Méthode Description
createResponse ( SimpleSocket $socket ) : SimpleHttpResponse Wraps the socket in a response parser.
dispatchRequest ( SimpleSocket $socket, SimpleFormEncoding $encoding ) Sends the headers.

Method Details

__construct() public méthode

These include proxy information, URL, cookies, headers, request method and choice of encoding.
public __construct ( SimpleRoute $route, SimpleFormEncoding $encoding )
$route SimpleRoute Request route.
$encoding SimpleFormEncoding Content to send with request.

addHeaderLine() public méthode

@param string $header_line Text of full header line.
public addHeaderLine ( string $header_line )
$header_line string

createResponse() protected méthode

Wraps the socket in a response parser.
protected createResponse ( SimpleSocket $socket ) : SimpleHttpResponse
$socket SimpleSocket Responding socket.
Résultat SimpleHttpResponse Parsed response object.

dispatchRequest() protected méthode

Sends the headers.
protected dispatchRequest ( SimpleSocket $socket, SimpleFormEncoding $encoding )
$socket SimpleSocket Open socket.
$encoding SimpleFormEncoding Content to send with request.

fetch() public méthode

Dispatches the content to the route's socket.
public fetch ( integer $timeout ) : SimpleHttpResponse
$timeout integer Connection timeout.
Résultat SimpleHttpResponse A response which may only have an error, but hopefully has a complete web page.

getHeaders() public méthode

Get the headers to be sent with the request.
public getHeaders ( ) : array
Résultat array

readCookiesFromJar() public méthode

Reads all the relevant cookies from the cookie jar.
public readCookiesFromJar ( SimpleCookieJar $jar, SimpleUrl $url )
$jar SimpleCookieJar Jar to read
$url SimpleUrl Url to use for scope.