日期:2014-05-18 浏览次数:20458 次
WebRequest Wrq = WebRequest.Create("你要采集的地址"); WebResponse Wrs = Wrq.GetResponse(); Stream strm = Wrs.GetResponseStream(); StreamReader sr = new StreamReader(strm, System.Text.Encoding.GetEncoding("UTF-8")); string allstrm; allstrm = sr.ReadToEnd(); string strPattern = @"相关正则"; MatchCollection Matches = Regex.Matches(allstrm, strPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); foreach (Match NextMatch in Matches) { str = NextMatch.Groups["src"].Value.ToString().Trim(); }
------解决方案--------------------
帮你写了
你看下我写的这个网址
http://topic.csdn.net/u/20081223/09/a7e18f4f-400c-420f-9bd0-7949b87bddf0.html