42 public static function request( $method, $url, array $options = [], $caller = __METHOD__ ) {
43 $ret = MediaWikiServices::getInstance()->getHttpRequestFactory()->request(
44 $method, $url, $options, $caller );
45 return is_string( $ret ) ? $ret :
false;
61 public static function get( $url, array $options = [], $caller = __METHOD__ ) {
62 $args = func_get_args();
63 if ( isset(
$args[1] ) && ( is_string(
$args[1] ) || is_numeric(
$args[1] ) ) ) {
66 wfWarn(
"Second parameter should not be a timeout.", 2 );
67 $options = isset(
$args[2] ) && is_array(
$args[2] ) ?
69 $options[
'timeout'] =
$args[1];
85 public static function post( $url, array $options = [], $caller = __METHOD__ ) {
96 return MediaWikiServices::getInstance()->getHttpRequestFactory()->getUserAgent();
116 return MWHttpRequest::isValidURI( $uri );
128 $httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
129 MainConfigNames::HTTPProxy );
130 return (
string)$httpProxy;
142 $httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
143 MainConfigNames::HTTPProxy );
144 return MediaWikiServices::getInstance()->getHttpRequestFactory()
145 ->createMultiClient( $options + [
'proxy' => $httpProxy ] );
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 a deprecated feature was used.
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.
A class containing constants representing the names of configuration variables.