获取其他网站网页中的内容
时间:2011-03-19 来源:坏黑豹
string url = "http://www.baidu.com";
WebRequest CmcnUrl = WebRequest.Create(url);
CmcnUrl.UseDefaultCredentials = false;
WebResponse WebRe = CmcnUrl.GetResponse();
Stream strCmcn = WebRe.GetResponseStream();
StreamReader stRCmcnHtml = new StreamReader(strCmcn, Encoding.UTF8);
StreamWriter Sw = new StreamWriter(System.Web.HttpContext.Current.Server.MapPath("1.html"), false, Encoding.GetEncoding("UTF8")); ;
Sw.Write(stRCmcnHtml.ReadToEnd());
Sw.Flush();
Sw.Close();
Sw.Close();
strCmcn.Close();
WebRe.Close();
stRCmcnHtml.Close();
WebRequest CmcnUrl = WebRequest.Create(url);
CmcnUrl.UseDefaultCredentials = false;
WebResponse WebRe = CmcnUrl.GetResponse();
Stream strCmcn = WebRe.GetResponseStream();
StreamReader stRCmcnHtml = new StreamReader(strCmcn, Encoding.UTF8);
StreamWriter Sw = new StreamWriter(System.Web.HttpContext.Current.Server.MapPath("1.html"), false, Encoding.GetEncoding("UTF8")); ;
Sw.Write(stRCmcnHtml.ReadToEnd());
Sw.Flush();
Sw.Close();
Sw.Close();
strCmcn.Close();
WebRe.Close();
stRCmcnHtml.Close();
相关阅读 更多 +