标签:style blog http color os ar sp div art
1 /// <summary> 2 /// 获取网页源码 3 /// </summary> 4 /// <param name="Url">链接</param> 5 /// <param name="CharSet">编码</param> 6 /// <returns></returns> 7 public static string GetSource(string Url, string CharSet = "utf-8") 8 { 9 using (WebClient myWebClient = new WebClient()) 10 { 11 using (Stream myStream = myWebClient.OpenRead(Url)) 12 { 13 using (StreamReader sr = new StreamReader(myStream, System.Text.Encoding.GetEncoding(CharSet))) 14 { 15 return sr.ReadToEnd(); 16 } 17 } 18 } 19 }
标签:style blog http color os ar sp div art
原文地址:http://www.cnblogs.com/surfing/p/3999637.html