using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
StringBuilder html = new StringBuilder();//接收网页html字符串
WebRequest request = WebRequest.Create("http://www.51rk.net/");
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string strTemp;
while ((strTemp = reader.ReadLine()) != null)
{
html.Append(strTemp);
}
reader.Close();
response.Close();
MatchCollection mc = Regex.Matches(html.ToString(), "<img.+?src=\"(?<url>.+?)\".+?>", RegexOptions.IgnoreCase);//验证图片
foreach (Match m in mc)
{
Response.Write(m.Groups["url"].Value);//输出img地址
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
StringBuilder html = new StringBuilder();//接收网页html字符串
WebRequest request = WebRequest.Create("http://www.51rk.net/");
request.Credentials = CredentialCache.DefaultCredentials;
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string strTemp;
while ((strTemp = reader.ReadLine()) != null)
{
html.Append(strTemp);
}
reader.Close();
response.Close();
MatchCollection mc = Regex.Matches(html.ToString(), "<img.+?src=\"(?<url>.+?)\".+?>", RegexOptions.IgnoreCase);//验证图片
foreach (Match m in mc)
{
Response.Write(m.Groups["url"].Value);//输出img地址