 悬赏园豆:30
                [已关闭问题]
                悬赏园豆:30
                [已关闭问题] 
            
                 
        从别的网站上抓取数据 并存到自己的数据库里怎么做到
protected void btnselect_Click(object sender, EventArgs e)
{
GetStringByUrl("http://api.showji.com/locating/Query.aspx?m="+txtTEL.Text+"");
}
public string GetStringByUrl(string strUrl)
{
WebRequest wrt = WebRequest.Create(strUrl);
WebResponse wrse = wrt.GetResponse();
Stream strM = wrse.GetResponseStream();
StreamReader SR = new StreamReader(strM, Encoding.GetEncoding("utf-8"));
string strallstrm = SR.ReadToEnd();
lblCard0.Text = strallstrm;
TextBox1.Text = strallstrm;
return strallstrm; 
} 
上面是我写的代码asp.net的b/s结构 
从http://api.showji.com/locating/Query.aspx?m=网站上抓举 所属省份和所属城市和类型,希望各位net高手帮忙
我的qq359676564
(该问题以前有人提出过、我就再回答一次吧。)用到正则表达式、HttpWebRequest的一些网络知识。看一下下边的例子、很简单啊。
   Regex regex;  
        string[] weather = new string[5];
        string content = "";
        
        Match mcTmp;
        Match mcCity;
        int k = 1;
        HttpWebResponse theResponse;
        WebRequest theRequest;
        theRequest = WebRequest.Create("http://weather.news.qq.com/inc/ss82.htm");
        try
        {
            theResponse = (HttpWebResponse)theRequest.GetResponse();
            using (System.IO.Stream sm = theResponse.GetResponseStream())
            {
                System.IO.StreamReader read = new System.IO.StreamReader(sm, Encoding.Default);
                content = read.ReadToEnd();
            }
        }
        catch (Exception)
        {
            content = "";
        }
     
        string parttenTmp = "<td height=\"23\" width=\"117\" background=\"/images/r_tembg5.gif\" align=\"center\">(?<item1>[^<]+)</td>";
        k = 1;
        regex = new Regex(parttenTmp, RegexOptions.Compiled | RegexOptions.IgnoreCase);
        for (mcTmp = regex.Match(content), k = 1; mcTmp.Success; mcTmp = mcTmp.NextMatch(), k++)
        {
            weather[0] = mcTmp.Groups["item1"].Value;
        }
        parttenTmp = "height=\"23\" align=\"center\">(?<item1>[^/]+)</td>";
        k = 1;
        regex = new Regex(parttenTmp, RegexOptions.Compiled | RegexOptions.IgnoreCase);
        for (mcTmp = regex.Match(content), k = 1; mcTmp.Success; mcTmp = mcTmp.NextMatch(), k++)
        {
            weather[k] = mcTmp.Groups["item1"].Value;
        }
        return weather;
这个是以前写的一个抓取天气预报的方法.你可以参考一下。
找一个开源的爬虫工具研究一下