日期:2014-05-17 浏览次数:20905 次
HttpWebRequest request = (HttpWebRequest)WebRequest.CreateDefault(new Uri("http://www.ip138.com"));
WebProxy wp = new WebProxy("60.235.27.60:80", true);
request.Proxy = wp;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream sResponse = response.GetResponseStream();
StreamReader srResponse = new StreamReader(sResponse, Encoding.GetEncoding("GB2312"));
string strContent = srResponse.ReadToEnd();
srResponse.Close();
FileStream fs = new FileStream(@"D:\test.html", FileMode.Create);
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
sw.Write(strContent);
sw.Close();
fs.Close();