Private/request.ps1

1
2
3
4
5
6
7
function request( [string]$Url, $Timeout=100 ) {
    if ([string]::IsNullOrWhiteSpace($url)) {throw 'The URL is empty'}
    $request = [System.Net.WebRequest]::Create($Url)
    if ($Timeout)  { $request.Timeout = $Timeout*1000 }
    $request.GetResponse()
}