C#开发网页数据采集器要怎么做? C#网页数据采集器要怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <summary> /// 下载网页 /// </summary> /// <param name="Url">网址</param> /// <param name="myEncoding">编码</param> /// <returns>网页内容</returns> public static string DownHtml(string Url, Encoding myEncoding) { try { HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(Url); loHttp.Timeout = 500; HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse(); StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), myEncoding); string html = loResponseStream.ReadToEnd(); loWebResponse.Close(); return html; } catch { return null; } } 差着十万八千里了。看看这个贴子~~http://bbs.locoy.com/viewthread.php?tid=31216&highlight=%B2%C9%BC%AF%D4%AD%C0%ED 【新手问题】如何把XML中指定的某个NODE的VALUE值提取出来 Windows Phone 7 非托管代码 调用 ATL编译好的dll winform 中如何获取服务器的IP地址? java转C#遇到的问题! 怎样实现以下功能?类的实例可以通过字符串关键字查询 初学,为什么创建的web窗体,在预览时看不到控件,只能看到文本??? 如何指定程序的当前窗口? 在C#中如何调用C的动态连接库 GDI+中的鼠标事件 请这里的专家帮忙 【开源代码的项目】和【商业运作的项目】那个更能促进技术发展 请教个比较复杂的正则表达式
/// <summary>
/// 下载网页
/// </summary>
/// <param name="Url">网址</param>
/// <param name="myEncoding">编码</param>
/// <returns>网页内容</returns>
public static string DownHtml(string Url, Encoding myEncoding)
{
try
{
HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(Url);
loHttp.Timeout = 500;
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), myEncoding);
string html = loResponseStream.ReadToEnd();
loWebResponse.Close();
return html;
}
catch
{
return null;
}
}