Http

Extends Http

HTTP client class for connecting to a MediaWiki instance.

since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct(mixed||string|int options = [], \Joomla\Http\TransportInterface transport = null) : 
since

12.3

Arguments

options

array<string|int, mixed>Client options object.

transport

TransportInterface|nullThe HTTP transport object.

Response

mixed

delete

Method to send the DELETE command to the server.

delete(string|\Joomla\Uri\UriInterface url, mixed||string|int headers = [],  timeout = null,  data = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

data

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

Response

Response

get

Method to send the GET command to the server.

get(string|\Joomla\Uri\UriInterface url, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

getOption

Get an option from the HTTP client.

getOption( key,  default = null) : 
since

1.0

Arguments

key

stringThe name of the option to get.

default

mixedThe default value if the option is not set.

Response

mixedThe option value.

head

Method to send the HEAD command to the server.

head(string|\Joomla\Uri\UriInterface url, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

makeTransportRequest

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

makeTransportRequest( method, string|\Joomla\Uri\UriInterface url,  data = null, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

throws

InvalidArgumentException

Arguments

method

stringThe HTTP method for sending the request.

url

string|UriInterfaceThe URI to the resource to request.

data

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

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

options

Method to send the OPTIONS command to the server.

options(string|\Joomla\Uri\UriInterface url, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

patch

Method to send the PATCH command to the server.

patch(string|\Joomla\Uri\UriInterface url,  data, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

data

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

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

post

Method to send the POST command to the server.

post(string|\Joomla\Uri\UriInterface url,  data, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

data

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

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

put

Method to send the PUT command to the server.

put(string|\Joomla\Uri\UriInterface url,  data, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

data

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

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

sendRequest

Sends a PSR-7 request and returns a PSR-7 response.

sendRequest(\Psr\Http\Message\RequestInterface request) : \Psr\Http\Message\ResponseInterface|\Joomla\Http\Response
since

2.0.0

Arguments

request

RequestInterfaceThe PSR-7 request object.

Response

ResponseInterface|Response

setOption

Set an option for the HTTP client.

setOption( key,  value) : 
since

1.0

Arguments

key

stringThe name of the option to set.

value

mixedThe option value to set.

Response

$this

trace

Method to send the TRACE command to the server.

trace(string|\Joomla\Uri\UriInterface url, mixed||string|int headers = [],  timeout = null) : \Joomla\Http\Response
since

1.0

Arguments

url

string|UriInterfaceThe URI to the resource to request.

headers

array<string|int, mixed>An array of request headers to send with the request.

timeout

intRead timeout in seconds.

Response

Response

Properties

options

Options for the HTTP client.

since

1.0

Type(s)

array<string|int, mixed>|ArrayAccess

transport

The HTTP transport object to use in sending HTTP requests.

since

1.0

Type(s)

TransportInterface