从local.ch搜索数据导出

时间:2011-03-05 07:46:55

标签: c# asp.net search-engine

我想从“local.ch”网站导出数据。

我可以使用哪种方法?

1 个答案:

答案 0 :(得分:1)

static string GetContent()
{
url = 'http://local.ch';
WebClient client = new WebClient();
client.Headers.Add("user-agent", 
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
Stream data = client.OpenRead(url);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
return s;
}

引自http://www.charlesrcook.com/archive/2008/11/15/pulling-web-content-with-c.aspx