程序猿改变世界
/// <summary>
/// 根据网址取得HTML代码
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
static
string
GetHtml(
string
url)
{
HttpWebRequest request = WebRequest.Create(url)
as
HttpWebRequest;
HttpWebResponse response = request.GetResponse()
as
HttpWebResponse;
Stream stream = response.GetResponseStream();
StreamReader reader =
new
StreamReader(stream, Encoding.Default);
string
html = reader.ReadToEnd();
stream.Close();
return
html;
}
来源:时间去哪儿了博客(微信/QQ号:903918446),转载请保留出处和链接!
本文链接:http://timegowhere.com/post/GetHtml.html
本文标签:
【个人微信】
【时间去哪儿了】
教育类博客,关注知识的分享与交流。
欢迎关注公众号!
加我微信
Copyright © 2014-2016 timegowhere.com. All rights reserved. 粤ICP备15081222号