Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -29,6 +29,8 @@ |
30 | 30 | * - followRedirects Whether to follow redirects (defaults to false). |
31 | 31 | * Note: this should only be used when the target URL is trusted, |
32 | 32 | * to avoid attacks on intranet services accessible by HTTP. |
| 33 | + * - userAgent A user agent, if you want to override the default |
| 34 | + * MediaWiki/$wgVersion |
33 | 35 | * @return Mixed: (bool)false on failure or a string on success |
34 | 36 | */ |
35 | 37 | public static function request( $method, $url, $options = array() ) { |
— | — | @@ -40,6 +42,9 @@ |
41 | 43 | } |
42 | 44 | |
43 | 45 | $req = MWHttpRequest::factory( $url, $options ); |
| 46 | + if( isset( $options['userAgent'] ) ) { |
| 47 | + $req->setUserAgent( $options['userAgent'] ); |
| 48 | + } |
44 | 49 | $status = $req->execute(); |
45 | 50 | |
46 | 51 | if ( $status->isOK() ) { |