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 [WebClientOptions | array] the Web Client options create($vertx, $options)

Arguments

$arg0

Vertx

$arg1

WebClientOptions | 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 an HTTP request to send to the server at the default host and port.

request( $arg0,  $arg1,  $arg2 = null,  $arg3 = 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 [RequestOptions | 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)

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)

Arguments

$arg0

string

$arg1

string | RequestOptions | array | integer

$arg2

string

$arg3

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) : \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

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 [WebClientOptions | array] the Web Client options wrap($httpClient, $options)

Arguments

$arg0

HttpClient

$arg1

WebClientOptions | array

Response

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

the web client