45 public static function request( $method, $url, array $options = [], $caller = __METHOD__ ) {
46 $ret = MediaWikiServices::getInstance()->getHttpRequestFactory()->request(
47 $method, $url, $options, $caller );
48 return is_string( $ret ) ? $ret :
false;
64 public static function get( $url, array $options = [], $caller = __METHOD__ ) {
65 $args = func_get_args();
66 if ( isset(
$args[1] ) && ( is_string(
$args[1] ) || is_numeric(
$args[1] ) ) ) {
69 wfWarn(
"Second parameter should not be a timeout.", 2 );
70 $options = isset(
$args[2] ) && is_array(
$args[2] ) ?
72 $options[
'timeout'] =
$args[1];
88 public static function post( $url, array $options = [], $caller = __METHOD__ ) {
99 return MediaWikiServices::getInstance()->getHttpRequestFactory()->getUserAgent();
119 return MWHttpRequest::isValidURI( $uri );
150 'userAgent' => self::userAgent(),
152 'logger' => LoggerFactory::getInstance(
'http' )
int $wgHTTPTimeout
Timeout for HTTP requests done internally, in seconds.
$wgHTTPConnectTimeout
Timeout for connections done internally (in seconds) Only works for curl.
$wgHTTPProxy
Proxy to use for CURL requests.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Various HTTP related functions.
static request( $method, $url, array $options=[], $caller=__METHOD__)
Perform an HTTP request.
static isValidURI( $uri)
Check that the given URI is a valid one.
static userAgent()
A standard user-agent we can use for external requests.
static createMultiClient(array $options=[])
Get a configured MultiHttpClient.
static post( $url, array $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'POST' )
static getProxy()
Gets the relevant proxy from $wgHTTPProxy.
Class to handle multiple HTTP requests.