powershell http get 不使用代理 [英] powershell http get not use proxy

查看:47
本文介绍了powershell http get 不使用代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有脚本来获取 HTTP 内容,我需要 baypass 代理(直接连接到网络服务器 IP).是否可以不更改 Windows 中的寄存器?此代码正在通过系统中定义的代理.谢谢指教

I have script to GET HTTP content and I need baypass Proxy (connect directly to webserver IP). Is it possible without changing registers in Windows?. This code is going through proxy defined in system. Thanks for advice

最好的问候.

$url='https://10.10.10.10/check';
$webClient = new-object System.Net.WebClient;
$output = $webClient.DownloadString($url)

推荐答案

根据 文档 您必须将代理设置为空白代理实例.试试这个:

According to the documentation you have to set the proxy to a blank proxy instance. Try this:

$url = "https://10.10.10.10/check"
$webClient = New-Object System.Net.WebClient
$webClient.Proxy = [System.Net.GlobalProxySelection]::GetEmptyWebProxy()
$output = $webClient.DownloadString($url)

这篇关于powershell http get 不使用代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆