Sends an HTTP request using best available transport method.
public static sendHttpRequest ( string $aUrl, integer $timeout, string | null $userAgent = null, string | null $destinationPath = null, integer | null $followDepth, boolean $acceptLanguage = false, array | boolean $byteRange = false, boolean $getExtendedInfo = false, string $httpMethod = 'GET', string $httpUsername = null, string $httpPassword = null ) : boolean | string | ||
$aUrl | string | The target URL. |
$timeout | integer | The number of seconds to wait before aborting the HTTP request. |
$userAgent | string | null | The user agent to use. |
$destinationPath | string | null | If supplied, the HTTP response will be saved to the file specified by this path. |
$followDepth | integer | null | Internal redirect count. Should always pass `null` for this parameter. |
$acceptLanguage | boolean | The value to use for the `'Accept-Language'` HTTP request header. |
$byteRange | array | boolean | For `Range:` header. Should be two element array of bytes, eg, `array(0, 1024)` Doesn't work w/ `fopen` transport method. |
$getExtendedInfo | boolean | If true returns the status code, headers & response, if false just the response. |
$httpMethod | string | The HTTP method to use. Defaults to `'GET'`. |
$httpUsername | string | HTTP Auth username |
$httpPassword | string | HTTP Auth password |
return | boolean | string | If `$destinationPath` is not specified the HTTP response is returned on success. `false` is returned on failure. If `$getExtendedInfo` is `true` and `$destinationPath` is not specified an array with the following information is returned on success: - **status**: the HTTP status code - **headers**: the HTTP headers - **data**: the HTTP response data `false` is still returned on failure. |