Various HTTP related functions.
More...
|
| static | createMultiClient (array $options=[]) |
| | Get a configured MultiHttpClient.
|
| |
| static | get ( $url, array $options=[], $caller=__METHOD__) |
| | Simple wrapper for Http::request( 'GET' )
|
| |
| static | getProxy () |
| | Gets the relevant proxy from $wgHTTPProxy.
|
| |
| static | isValidURI ( $uri) |
| | Check that the given URI is a valid one.
|
| |
| static | post ( $url, array $options=[], $caller=__METHOD__) |
| | Simple wrapper for Http::request( 'POST' )
|
| |
| static | request ( $method, $url, array $options=[], $caller=__METHOD__) |
| | Perform an HTTP request.
|
| |
| static | userAgent () |
| | A standard user-agent we can use for external requests.
|
| |
Various HTTP related functions.
- Deprecated
- since 1.34
Definition at line 29 of file Http.php.
◆ createMultiClient()
| static Http::createMultiClient |
( |
array | $options = [] | ) |
|
|
static |
◆ get()
| static Http::get |
( |
| $url, |
|
|
array | $options = [], |
|
|
| $caller = __METHOD__ ) |
|
static |
Simple wrapper for Http::request( 'GET' )
- Deprecated
- since 1.34, use HttpRequestFactory::get()
- Since
- 1.25 Second parameter $timeout removed. Second parameter is now $options which can be given a 'timeout'
- Parameters
-
| string | $url | |
| array | $options | |
| string | $caller | The method making this request, for profiling |
- Returns
- string|bool false on error
Definition at line 61 of file Http.php.
References $args, request(), and wfWarn().
◆ getProxy()
| static Http::getProxy |
( |
| ) |
|
|
static |
Gets the relevant proxy from $wgHTTPProxy.
- Deprecated
- since 1.34, use $wgHTTPProxy directly
- Returns
- string The proxy address or an empty string if not set.
Definition at line 125 of file Http.php.
References wfDeprecated().
◆ isValidURI()
| static Http::isValidURI |
( |
| $uri | ) |
|
|
static |
Check that the given URI is a valid one.
This hardcodes a small set of protocols only, because we want to deterministically reject protocols not supported by all HTTP-transport methods.
"file://" specifically must not be allowed, for security purpose (see https://www.mediawiki.org/wiki/Special:Code/MediaWiki/r67684).
- Todo
- FIXME this is wildly inaccurate and fails to actually check most stuff
- Deprecated
- since 1.34, use MWHttpRequest::isValidURI
- Parameters
-
| string | $uri | URI to check for validity |
- Returns
- bool
Definition at line 115 of file Http.php.
◆ post()
| static Http::post |
( |
| $url, |
|
|
array | $options = [], |
|
|
| $caller = __METHOD__ ) |
|
static |
Simple wrapper for Http::request( 'POST' )
- Deprecated
- since 1.34, use HttpRequestFactory::post()
- Parameters
-
| string | $url | |
| array | $options | |
| string | $caller | The method making this request, for profiling |
- Returns
- string|bool false on error
Definition at line 85 of file Http.php.
References request().
◆ request()
| static Http::request |
( |
| $method, |
|
|
| $url, |
|
|
array | $options = [], |
|
|
| $caller = __METHOD__ ) |
|
static |
Perform an HTTP request.
- Deprecated
- since 1.34, use HttpRequestFactory::request()
- Parameters
-
| string | $method | HTTP method. Usually GET/POST |
| string | $url | Full URL to act on. If protocol-relative, will be expanded to an http:// URL |
| array | $options | Options to pass to MWHttpRequest object. See HttpRequestFactory::create docs |
| string | $caller | The method making this request, for profiling |
- Returns
- string|bool (bool)false on failure or a string on success
Definition at line 42 of file Http.php.
Referenced by get(), and post().
◆ userAgent()
| static Http::userAgent |
( |
| ) |
|
|
static |
A standard user-agent we can use for external requests.
- Deprecated
- since 1.34, use HttpRequestFactory::getUserAgent()
- Returns
- string
Definition at line 95 of file Http.php.
The documentation for this class was generated from the following file: