嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 3 元微信扫码支付:3 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
ProxyIP 代理ip批量验证,可自定义HOST、自定义header、支持http和https
public void new_process()
{
// comboBox1.DropDownStyle= System.Windows.Forms.ComboBoxStyle.DropDownList;//定义下拉框,无法编辑
string check_ip1 = "http://" textBox5.Text;
//string check_ip1 = "https://www.baidu.com";
if (checkBox2.Checked == true)
{
//check_ip1 = "https://www.baidu.com";
if (comboBox1.SelectedItem.ToString() == "百度") //验证https connect相应
{
// check_ip1 = null;
check_ip1 = "https://www.baidu.com";
}
if (comboBox1.SelectedItem.ToString() == "搜狗") //验证https connect相应
{
// check_ip1 = null;
check_ip1 = "https://www.sogou.com";
}
}
string[] ip = textBox1.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); //整形数组 //Split()末尾添加()间隔符char为'xx',string为"xx"
for (int i = 0; i < ip.Length; i )
{
label6.Text = "共计:" ip.Length;
label7.Text = "还剩:" (ip.Length-i-1);
label4.Text = "当前验证ip:" ip[i].ToString();
// Thread.Sleep(1000);//延时1000ms
// Application.DoEvents();
//HttpWebResponse webResp = null;
//Stream respStream = null;
//StreamReader objReader = null;
try
{
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(check_ip1);
System.Net.WebProxy proxyObject = new WebProxy(ip[i].ToString());// port为端口号 整数型
webReq.Proxy = proxyObject;
//webReq.ProtocolVersion = HttpVersion.Version10;
// ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
// ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
// webReq.ContentType = "application/x-www-form-urlencoded";
// webReq.Accept = "text/html,application/xhtml xml,application/xml;q=0.9,*/*;q=0.8";
//webReq.Headers.Add("Accept-Language", "zh-cn,en-us;q=0.8,zh-hk;q=0.6,ja;q=0.4,zh;q=0.2");
// webReq.UserAgent= "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)";
//webReq.Headers.Set("User-Agent", "Dalvik / 2.1.0(Linux; U; Android 6.0; Le X620 Build / HEXCNFN5902303291S)");
webReq.Timeout = 1000 * 5;
//webReq.Referer = "http://www.microsoft.com";
if (checkBox3.Checked == true)
{
webReq.Host = textBox6.Text;
}
HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
TextReader reader = new StreamReader(response.GetResponseStream(),System.Text.Encoding.GetEncoding("utf-8"));
string wen = reader.ReadToEnd();
textBox3.Clear();
textBox3.Text = wen;//读取文本html
if (checkBox1.Checked == true)
{
if (wen.Contains(textBox4.Text))//搜索字符
{
textBox2.SelectedText = ip[i].ToString() "\r\n";
textBox2.ScrollToCaret();
}
}
//textBox2.Text = ip[i].ToString() "\r\n";
if (checkBox1.Checked == false)
{
textBox2.SelectedText = ip[i].ToString() "\r\n";//新增输出不重赋值
textBox2.ScrollToCaret();
}
reader.Close();
// weatherStream.Close();
response.Close();
}
catch (WebException ex)
{
textBox3.Text = ("无法连接到服务器\r\n错误信息:" ex.Message);
}
finally
{
label4.Text = "";
}
}