WebClient

An asynchronous HTTP / HTTP/2 client called <code>WebClient</code>.

The web client makes easy to do HTTP request/response interactions with a web server, and provides advanced features like:

  • Json body encoding / decoding
  • request/response pumping
  • error handling

The web client does not deprecate the , it is actually based on it and therefore inherits its configuration and great features like pooling. The HttpClient should be used when fine grained control over the HTTP requests/response is necessary.

package

Default

Methods

__construct

__construct() 

Close the client. Closing will close down any pooled connections.

close() : void

Clients should always be closed after use.

Create a web client using the provided <code>vertx</code> instance and default options.

create( $arg0,  $arg1 = null) : \io\vertx\jphp\ext\web\client\WebClient
static

param $vertx [Vertx] the vertx instance create($vertx)

Create a web client using the provided vertx instance.

param $vertx [Vertx] the vertx instance param $options [array] the Web Client options create($vertx, $options)

Arguments

$arg0

Vertx

$arg1

array

Response

\io\vertx\jphp\ext\web\client\WebClient

the created web client

Create an HTTP DELETE request to send to the server at the default host and port.

delete( $arg0,  $arg1 = null,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $requestURI [string] the relative URI delete($requestURI)

Create an HTTP DELETE request to send to the server at the specified host and default port.

param $host [string] the host param $requestURI [string] the relative URI delete($host, $requestURI)

Create an HTTP DELETE request to send to the server at the specified host and port.

param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI delete($port, $host, $requestURI)

Arguments

$arg0

string | integer

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP DELETE request to send to the server using an absolute URI, specifying a response handler to receive the response

deleteAbs( $arg0) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP GET request to send to the server at the default host and port.

get( $arg0,  $arg1 = null,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $requestURI [string] the relative URI get($requestURI)

Create an HTTP GET request to send to the server at the specified host and default port.

param $host [string] the host param $requestURI [string] the relative URI get($host, $requestURI)

Create an HTTP GET request to send to the server at the specified host and port.

param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI get($port, $host, $requestURI)

Arguments

$arg0

string | integer

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP GET request to send to the server using an absolute URI, specifying a response handler to receive the response

getAbs( $arg0) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP HEAD request to send to the server at the default host and port.

head( $arg0,  $arg1 = null,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $requestURI [string] the relative URI head($requestURI)

Create an HTTP HEAD request to send to the server at the specified host and default port.

param $host [string] the host param $requestURI [string] the relative URI head($host, $requestURI)

Create an HTTP HEAD request to send to the server at the specified host and port.

param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI head($port, $host, $requestURI)

Arguments

$arg0

string | integer

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP HEAD request to send to the server using an absolute URI, specifying a response handler to receive the response

headAbs( $arg0) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP PATCH request to send to the server at the default host and port.

patch( $arg0,  $arg1 = null,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $requestURI [string] the relative URI patch($requestURI)

Create an HTTP PATCH request to send to the server at the specified host and default port.

param $host [string] the host param $requestURI [string] the relative URI patch($host, $requestURI)

Create an HTTP PATCH request to send to the server at the specified host and port.

param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI patch($port, $host, $requestURI)

Arguments

$arg0

string | integer

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP PATCH request to send to the server using an absolute URI, specifying a response handler to receive the response

patchAbs( $arg0) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP POST request to send to the server at the default host and port.

post( $arg0,  $arg1 = null,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $requestURI [string] the relative URI post($requestURI)

Create an HTTP POST request to send to the server at the specified host and default port.

param $host [string] the host param $requestURI [string] the relative URI post($host, $requestURI)

Create an HTTP POST request to send to the server at the specified host and port.

param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI post($port, $host, $requestURI)

Arguments

$arg0

string | integer

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP POST request to send to the server using an absolute URI, specifying a response handler to receive the response

postAbs( $arg0) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP PUT request to send to the server at the default host and port.

put( $arg0,  $arg1 = null,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $requestURI [string] the relative URI put($requestURI)

Create an HTTP PUT request to send to the server at the specified host and default port.

param $host [string] the host param $requestURI [string] the relative URI put($host, $requestURI)

Create an HTTP PUT request to send to the server at the specified host and port.

param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI put($port, $host, $requestURI)

Arguments

$arg0

string | integer

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP PUT request to send to the server using an absolute URI, specifying a response handler to receive the response

putAbs( $arg0) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create a request with a custom HTTP method to send to the server at the default host and port.

raw( $arg0,  $arg1,  $arg2 = null,  $arg3 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $customHttpMethod [string] custom HTTP Method param $requestURI [string] the relative URI raw($customHttpMethod, $requestURI)

Create a request with a custom HTTP method to send to the server at the specified host and default port.

param $customHttpMethod [string] custom HTTP Method param $host [string] the host param $requestURI [string] the relative URI raw($customHttpMethod, $host, $requestURI)

Create a request with a custom HTTP method to send to the server at the specified host and port.

param $customHttpMethod [string] custom HTTP Method param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI raw($customHttpMethod, $port, $host, $requestURI)

Arguments

$arg0

string

$arg1

string | integer

$arg2

string

$arg3

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create a request with a custom HTTP method to send to the server using an absolute URI, specifying a response handler to receive the response

rawAbs( $arg0,  $arg1) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

Arguments

$arg0

string

$arg1

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP request to send to the server at the default host and port.

request( $arg0,  $arg1,  $arg2 = null,  $arg3 = null,  $arg4 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $method [string] the HTTP method param $requestURI [string] the relative URI request($method, $requestURI)

Create an HTTP request to send to the server at the specified host and port.

param $method [string] the HTTP method param $options [array] the request options request($method, $options)

Create an HTTP request to send to the server at the specified host and default port.

param $method [string] the HTTP method param $host [string] the host param $requestURI [string] the relative URI request($method, $host, $requestURI)

Like @see \io\vertx\jphp\ext\web\client\WebClient::request using the serverAddress parameter to connect to the server instead of the default port and default host.

The request host header will still be created from the default port and default host.

Use to connect to a unix domain socket server. param $method [string] param $serverAddress [SocketAddress] param $requestURI [string] request($method, $serverAddress, $requestURI) Like @see \io\vertx\jphp\ext\web\client\WebClient::request using the serverAddress parameter to connect to the server instead of the options parameter.

The request host header will still be created from the options parameter.

Use to connect to a unix domain socket server. param $method [string] param $serverAddress [SocketAddress] param $options [array] request($method, $serverAddress, $options) Create an HTTP request to send to the server at the specified host and port. param $method [string] the HTTP method param $port [integer] the port param $host [string] the host param $requestURI [string] the relative URI request($method, $port, $host, $requestURI) Like @see \io\vertx\jphp\ext\web\client\WebClient::request using the serverAddress parameter to connect to the server instead of the default port and host parameter.

The request host header will still be created from the default port and host parameter.

Use to connect to a unix domain socket server. param $method [string] param $serverAddress [SocketAddress] param $host [string] param $requestURI [string] request($method, $serverAddress, $host, $requestURI) Like @see \io\vertx\jphp\ext\web\client\WebClient::request using the serverAddress parameter to connect to the server instead of the port and host parameters.

The request host header will still be created from the port and host parameters.

Use to connect to a unix domain socket server. param $method [string] param $serverAddress [SocketAddress] param $port [integer] param $host [string] param $requestURI [string] request($method, $serverAddress, $port, $host, $requestURI)

Arguments

$arg0

string

$arg1

string | array | integer | SocketAddress

$arg2

string | array | integer

$arg3

string

$arg4

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Create an HTTP request to send to the server using an absolute URI

requestAbs( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\web\client\HttpRequest<Buffer>

param $method [string] the HTTP method param $absoluteURI [string] the absolute URI requestAbs($method, $absoluteURI)

Like @see \io\vertx\jphp\ext\web\client\WebClient::requestAbs using the serverAddress parameter to connect to the server instead of the absoluteURI parameter.

The request host header will still be created from the absoluteURI parameter.

Use to connect to a unix domain socket server. param $method [string] param $serverAddress [SocketAddress] param $absoluteURI [string] requestAbs($method, $serverAddress, $absoluteURI)

Arguments

$arg0

string

$arg1

string | SocketAddress

$arg2

string

Response

\io\vertx\jphp\ext\web\client\HttpRequest

an HTTP client request object

Wrap an <code>httpClient</code> with a web client and default options.

wrap( $arg0,  $arg1 = null) : \io\vertx\jphp\ext\web\client\WebClient
static

param $httpClient [HttpClient] the HttpClient to wrap wrap($httpClient)

Wrap an httpClient with a web client and default options.

Only the specific web client portion of the options is used, the @see \io\vertx\jphp\core\http\HttpClientOptions of the httpClient is reused. param $httpClient [HttpClient] the [HttpClient](../classes/io.vertx.jphp.core.http.HttpClient.html) to wrap param $options [array] the Web Client options wrap($httpClient, $options)

Arguments

$arg0

HttpClient

$arg1

array

Response

\io\vertx\jphp\ext\web\client\WebClient

the web client