JHttpTransportSocket

Implements \JHttpTransport

HTTP transport class for using sockets directly.

package

Joomla.Platform

subpackage

HTTP

since

11.3

Methods

__construct

Constructor.

__construct(\JRegistry &$options) 
since

11.3

throws

\RuntimeException

Arguments

$options

\JRegistry

connect

Method to connect to a server and get the resource.

connect(\JUri $uri, integer $timeout = null) : resource
since

11.3

throws

\RuntimeException

Arguments

$uri

\JUriThe URI to connect with.

$timeout

integerRead timeout in seconds.

Response

resourceSocket connection resource.

getResponse

Method to get a response object from a server response.

getResponse(string $content) : \JHttpResponse
since

11.3

throws

\UnexpectedValueException

Arguments

$content

stringThe complete server response, including headers.

Response

\JHttpResponse

isSupported

method to check if http transport socket available for using

isSupported() : boolean
static
since

12.1

Response

booleantrue if available else false

request

Send a request to the server and return a JHttpResponse object with the response.

request(string $method, \JUri $uri, mixed $data = null, array $headers = null, integer $timeout = 30, string $userAgent = null) : \JHttpResponse
since

11.3

throws

\RuntimeException

Arguments

$method

stringThe HTTP method for sending the request.

$uri

\JUriThe URI to the resource to request.

$data

mixedEither an associative array or a string to be sent with the request.

$headers

arrayAn array of request headers to send with the request.

$timeout

integerRead timeout in seconds.

$userAgent

stringThe optional user agent string to send with the request.

Response

\JHttpResponse

Properties

connections

Reusable socket connections.

since

11.3

Type(s)

array

options

The client options.

since

11.3

Type(s)

\JRegistry