42 public static function request( $method, $url, array $options = [], $caller = __METHOD__ ) {
44 $ret = MediaWikiServices::getInstance()->getHttpRequestFactory()->request(
45 $method, $url, $options, $caller );
46 return is_string( $ret ) ? $ret :
false;
62 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__ ) {
100 return MediaWikiServices::getInstance()->getHttpRequestFactory()->getUserAgent();
121 return MWHttpRequest::isValidURI( $uri );
133 $httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
134 MainConfigNames::HTTPProxy );
135 return (
string)$httpProxy;
147 $httpProxy = MediaWikiServices::getInstance()->getMainConfig()->get(
148 MainConfigNames::HTTPProxy );
149 return MediaWikiServices::getInstance()->getHttpRequestFactory()
150 ->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.