ip批量提取,可提取网页中的ip地址 try
{
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(ip1);
//System.Net.WebProxy proxyObject = new WebProxy(ip[i].ToString());// port为端口号 整数型
//webReq.Proxy = proxyObject;
HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
// response.Cookies["username"].Value = "gjy";
// response.Cookies["username"].Expires = DateTime.Now.AddDays(1);
// Thread.Sleep(2000);//延时1000ms
// webReq.Timeout = 1000 * 5;Encoding.UTF8
TextReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
wen = reader.ReadToEnd();
textBox1.Text = wen;
// MessageBox.Show(wen);
}
catch (WebException ex)
{
textBox3.Text = ("无法连接到服务器\r\n错误信息:" ex.Message);
}
评论