44 public static function request( $method, $url, array $options = [], $caller = __METHOD__ ) {
45 $ret = MediaWikiServices::getInstance()->getHttpRequestFactory()->request(
46 $method, $url, $options, $caller );
47 return is_string( $ret ) ? $ret :
false;
63 public static function get( $url, array $options = [], $caller = __METHOD__ ) {
64 $args = func_get_args();
65 if ( isset(
$args[1] ) && ( is_string(
$args[1] ) || is_numeric(
$args[1] ) ) ) {
68 wfWarn(
"Second parameter should not be a timeout.", 2 );
69 $options = isset(
$args[2] ) && is_array(
$args[2] ) ?
71 $options[
'timeout'] =
$args[1];
87 public static function post( $url, array $options = [], $caller = __METHOD__ ) {
98 return MediaWikiServices::getInstance()->getHttpRequestFactory()->getUserAgent();
118 return MWHttpRequest::isValidURI( $uri );
144 return MediaWikiServices::getInstance()->getHttpRequestFactory()
145 ->createMultiClient( $options + [
'proxy' =>
$wgHTTPProxy ] );
$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)
Logs 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.