Skip to content

Instantly share code, notes, and snippets.

@iamsunny
Last active August 8, 2022 13:49
Show Gist options
  • Save iamsunny/b39deaf90bf7e1dabc9e927e52e8829d to your computer and use it in GitHub Desktop.
Save iamsunny/b39deaf90bf7e1dabc9e927e52e8829d to your computer and use it in GitHub Desktop.
Loop Invoke-WebRequest in Powershell
class TrustAllCertsPolicy : System.Net.ICertificatePolicy {
[bool] CheckValidationResult([System.Net.ServicePoint] $a,
[System.Security.Cryptography.X509Certificates.X509Certificate] $b,
[System.Net.WebRequest] $c,
[int] $d) {
return $true
}
}
[System.Net.ServicePointManager]::CertificatePolicy = [TrustAllCertsPolicy]::new()
$count=1
while($true){
write-host $count
Invoke-Webrequest "https://docs.testthedocs.ml" > 1
$count++
}
###########################################################################################
$curlAlias = get-alias -name curl -ErrorAction SilentlyContinue
if($curlAlias.count -gt 0)
{ Remove-item alias:curl}
while(1)
{
#$url = "https://newp37.document360.net"
#$url = "https://toc-check.document360.info"
#$url = "https://docs.testthedocs.ml"
#$url = "https://docs.document360.io"
#$url = "https://api.document360.net"
$url = "https://www.google.com"
curl -o /dev/null -s -w 'Total: %{time_total}s\n' $url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment