Http

HTTP client class.

since

1.7.3

package

Joomla CMS

Methods

__construct

Constructor.

__construct(\Joomla\Registry\Registry options = null, \Joomla\CMS\Http\TransportInterface transport = null) : mixed
since

1.7.3

Arguments

options

\Joomla\Registry\RegistryClient options object. If the registry contains any headers.* elements, these will be added to the request headers.

transport

\Joomla\CMS\Http\TransportInterfaceThe HTTP transport object.

Response

mixed

delete

Method to send the DELETE command to the server.

delete(string url, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

get

Method to send the GET command to the server.

get(string url, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

getOption

Get an option from the HTTP client.

getOption(string key) : mixed
since

1.7.3

Arguments

key

stringThe name of the option to get.

Response

mixedThe option value.

head

Method to send the HEAD command to the server.

head(string url, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

options

Method to send the OPTIONS command to the server.

options(string url, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

patch

Method to send the PATCH command to the server.

patch(string url, mixed data, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

3.0.1

Arguments

url

stringPath to the resource.

data

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

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

post

Method to send the POST command to the server.

post(string url, mixed data, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

data

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

headers

arrayAn array of name-value pairs to include in the header of the request

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

put

Method to send the PUT command to the server.

put(string url, mixed data, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

data

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

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

setOption

Set an option for the HTTP client.

setOption(string key, mixed value) : \Joomla\CMS\Http\Http
since

1.7.3

Arguments

key

stringThe name of the option to set.

value

mixedThe option value to set.

Response

\Joomla\CMS\Http\HttpThis object for method chaining.

trace

Method to send the TRACE command to the server.

trace(string url, array headers = null, int timeout = null) : \Joomla\CMS\Http\Response
since

1.7.3

Arguments

url

stringPath to the resource.

headers

arrayAn array of name-value pairs to include in the header of the request.

timeout

intRead timeout in seconds.

Response

\Joomla\CMS\Http\Response

Properties

options

Options for the HTTP client.

since

1.7.3

Type(s)

\Joomla\Registry\Registry

transport

The HTTP transport object to use in sending HTTP requests.

since

1.7.3

Type(s)

\Joomla\CMS\Http\TransportInterface