c#快速验证代理IP是否有用
2个回答
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
展开全部
public void yanzhen(string str, int port)
{
WebProxy proxyObject = new WebProxy(str, port);
HttpWebRequest Req = (HttpWebRequest)WebRequest.Create("http://***/");
Req.Proxy = proxyObject;
HttpWebResponse Resp = (HttpWebResponse)Req.GetResponse();
string str = "";
string OkStr = "";
Encoding code = Encoding.GetEncoding("UTF-8");
using (StreamReader sr = new StreamReader(Resp.GetResponseStream(), code))
{
if (sr != null)
{
try
{
str = sr.ReadToEnd();
StringSub.substr(str, "<h2>", "</h2>", 0);
str = str.Substring(str.IndexOf(start) + start.Length);
OkStr = str.Substring(0, str.IndexOf(last));
MessageBox.Show("IP" + OkStr);
}
catch
{
MessageBox.Show("文件读取失败!");
}
finally
{
sr.Close();
}
}
}
}
{
WebProxy proxyObject = new WebProxy(str, port);
HttpWebRequest Req = (HttpWebRequest)WebRequest.Create("http://***/");
Req.Proxy = proxyObject;
HttpWebResponse Resp = (HttpWebResponse)Req.GetResponse();
string str = "";
string OkStr = "";
Encoding code = Encoding.GetEncoding("UTF-8");
using (StreamReader sr = new StreamReader(Resp.GetResponseStream(), code))
{
if (sr != null)
{
try
{
str = sr.ReadToEnd();
StringSub.substr(str, "<h2>", "</h2>", 0);
str = str.Substring(str.IndexOf(start) + start.Length);
OkStr = str.Substring(0, str.IndexOf(last));
MessageBox.Show("IP" + OkStr);
}
catch
{
MessageBox.Show("文件读取失败!");
}
finally
{
sr.Close();
}
}
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询