Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 如何在windows中检查txt文件中大量URL的代理响应并捕获txt文件中的输出?_Powershell_Proxy_Response - Fatal编程技术网

Powershell 如何在windows中检查txt文件中大量URL的代理响应并捕获txt文件中的输出?

Powershell 如何在windows中检查txt文件中大量URL的代理响应并捕获txt文件中的输出?,powershell,proxy,response,Powershell,Proxy,Response,我不想最终打开13k个URL,并检查它们是否被代理成功阻止。最终的结果是用适当的分隔符在文本文件中的一行中进行捕获,目前是否有任何类型的脚本正在运行? 使用powershell,您可以从文本文件中读取url,调用每个url并检查状态,然后写入文件 示例代码:我没有要测试的代理服务器,所以它不能保证工作 $urls = Get-Content C:\data\urls.txt foreach($url in $urls){ $webReq = [net.WebRequest]::Create("

我不想最终打开13k个URL,并检查它们是否被代理成功阻止。最终的结果是用适当的分隔符在文本文件中的一行中进行捕获,目前是否有任何类型的脚本正在运行? 使用powershell,您可以从文本文件中读取url,调用每个url并检查状态,然后写入文件

示例代码:我没有要测试的代理服务器,所以它不能保证工作

$urls = Get-Content C:\data\urls.txt

foreach($url in $urls){
$webReq = [net.WebRequest]::Create("$url")
$status = $webReq.GetResponse().Statuscode()

#this will return the status code i.e. '200', '500'. '404'
#according to http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_Server_Error
# Error 523 is Proxy Declined request error
# Print url and status code to file
echo "$url $status" >> c:\data\response.txt
}

适当的分隔符URL\u Name Proxy\u Response和Proxy\u Block\u Category