class DOMClient extends Client

This class provides access to a local or remote http server with a URL as a browser does

Properties

private array $httpserver
private array $parameters

Methods

void
__construct(array $server = array())

Constructor of class DOMClient

static DOMClient
createClient(array $server = array())

Returns an instance of this class as a client to access a local or remote server.

Crawler
request($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true)

Calls a URI and returns a Crawler object to navigate in a list of \DOMNode objects.

Crawler
get(string $uri, array $headers = array())

Calls a URI with the GET request method and returns a Crawler object to navigate in a list of \DOMNode objects.

Crawler
post(string $uri, array $headers, array $data)

Calls a URI with the POST request method and returns a Crawler object to navigate in a list of \DOMNode objects.

Response
doRequest(object $request)

Executes the request

Response
doRemoteRequest(object $request, string $scheme)

Executes the request to the remote server

Response
doLocalRequest(object $request, string $path)

Executes the request to the local server

string
decodeChunked(string $chunked)

Decodes a chunked content

string
makeRemote(array $server)

Makes a socket adress for a remote server

string
getPath(string $uri)

Returns the path part of an uri.

string
encodeData(array|string $data)

Encodes data to be usable in an url or a html form.

string
randomNonce(int $bits = 256)

Generates a random cryptographic nonce

Details

at line 100
void __construct(array $server = array())

Constructor of class DOMClient

Parameters

array $server (default: array() The server parameters

Return Value

void

at line 113
static DOMClient createClient(array $server = array())

Returns an instance of this class as a client to access a local or remote server.

Parameters

array $server (default: array() The server parameters

Return Value

DOMClient The instance of this class

at line 127
Crawler request($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true)

Calls a URI and returns a Crawler object to navigate in a list of \DOMNode objects.

Parameters

$method
$uri
array $parameters
array $files
array $server
$content
$changeHistory

Return Value

Crawler The Crawler object

at line 146
Crawler get(string $uri, array $headers = array())

Calls a URI with the GET request method and returns a Crawler object to navigate in a list of \DOMNode objects.

Parameters

string $uri The URI to fetch
array $headers (default: array() The headers of the request

Return Value

Crawler The Crawler object

at line 160
Crawler post(string $uri, array $headers, array $data)

Calls a URI with the POST request method and returns a Crawler object to navigate in a list of \DOMNode objects.

Parameters

string $uri The URI to fetch
array $headers The headers of the request
array $data The data to post

Return Value

Crawler The Crawler object

at line 172
protected Response doRequest(object $request)

Executes the request

Parameters

object $request The request instance

Return Value

Response The response of the server

at line 195
private Response doRemoteRequest(object $request, string $scheme)

Executes the request to the remote server

Parameters

object $request The request instance
string $scheme The scheme (http or https) of the request

Return Value

Response The response of the server

at line 266
private Response doLocalRequest(object $request, string $path)

Executes the request to the local server

Parameters

object $request The request instance
string $path The path of the uri resource relatively to the DOCUMENT_ROOT

Return Value

Response The response of the server

at line 291
private string decodeChunked(string $chunked)

Decodes a chunked content

Parameters

string $chunked The chunked content

Return Value

string The decoded content

at line 309
string makeRemote(array $server)

Makes a socket adress for a remote server

Parameters

array $server The server parameters

Return Value

string The socket adress

at line 327
string getPath(string $uri)

Returns the path part of an uri.

Parameters

string $uri The uri

Return Value

string The path part of the uri

at line 344
string encodeData(array|string $data)

Encodes data to be usable in an url or a html form.

Parameters

array|string $data The data to be encoded

Return Value

string The encoded data

at line 370
string randomNonce(int $bits = 256)

Generates a random cryptographic nonce

Parameters

int $bits (default: 256) The number of bits of the nonce

Return Value

string The cryptographic nonce