Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Client interface for sending HTTP requests.

File Size: 241 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 12 functions

  get()
  head()
  put()
  post()
  patch()
  delete()
  getAsync()
  headAsync()
  putAsync()
  postAsync()
  patchAsync()
  deleteAsync()

Functions that are not part of a class:

get($uri, array $options = [])   X-Ref
Create and send an HTTP GET request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

head($uri, array $options = [])   X-Ref
Create and send an HTTP HEAD request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

put($uri, array $options = [])   X-Ref
Create and send an HTTP PUT request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

post($uri, array $options = [])   X-Ref
Create and send an HTTP POST request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

patch($uri, array $options = [])   X-Ref
Create and send an HTTP PATCH request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

delete($uri, array $options = [])   X-Ref
Create and send an HTTP DELETE request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

getAsync($uri, array $options = [])   X-Ref
Create and send an asynchronous HTTP GET request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well. Use an array to provide a URL
template and additional variables to use in the URL template expansion.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

headAsync($uri, array $options = [])   X-Ref
Create and send an asynchronous HTTP HEAD request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well. Use an array to provide a URL
template and additional variables to use in the URL template expansion.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

putAsync($uri, array $options = [])   X-Ref
Create and send an asynchronous HTTP PUT request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well. Use an array to provide a URL
template and additional variables to use in the URL template expansion.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

postAsync($uri, array $options = [])   X-Ref
Create and send an asynchronous HTTP POST request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well. Use an array to provide a URL
template and additional variables to use in the URL template expansion.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

patchAsync($uri, array $options = [])   X-Ref
Create and send an asynchronous HTTP PATCH request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well. Use an array to provide a URL
template and additional variables to use in the URL template expansion.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.

deleteAsync($uri, array $options = [])   X-Ref
Create and send an asynchronous HTTP DELETE request.

Use an absolute path to override the base path of the client, or a
relative path to append to the base path of the client. The URL can
contain the query string as well. Use an array to provide a URL
template and additional variables to use in the URL template expansion.

param: string|UriInterface $uri     URI object or string.
param: array               $options Request options to apply.