信息采集程序的介绍
对于信息采集的程序相信很多小伙伴们都是非常陌生的,那么今天爱站小编就为大家总结一下信息采集程序的介绍,希望对大家有所帮助。aspx页面代码
采集开始代码
采集结束代码
.cs页面代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using NetShuai.Database;
private string PageUrl = "";
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
}
protected void Btn_GetUrlSource_Click(object sender, EventArgs e)
{
PageUrl = Txt_Url.Text;
WebRequest request = WebRequest.Create(PageUrl);
WebResponse response = request.GetResponse();
Stream resStream = response.GetResponseStream();
StreamReader sr = new StreamReader(resStream, System.Text.Encoding.Default);
Txt_UrlSource.Text = sr.ReadToEnd();
resStream.Close();
sr.Close();
}
protected void Btn_Result_Click(object sender, EventArgs e)
{
string strExp;
strExp = @"(?
MatchCollection mc = Regex.Matches(Server.HtmlEncode(Txt_UrlSource.Text), strExp);
for (int i = 0; i
{
Txt_Result.Text +=Server.HtmlDecode(mc[i].Value);
}
}
protected void Btn_ListCheck_Click(object sender, EventArgs e)
{
string strExp;
strExp = Server.HtmlEncode(Txt_First.Text);
MatchCollection mc = Regex.Matches(Server.HtmlEncode(Txt_UrlSource.Text), strExp);
if(mc.Count>1)
{
Response.Write("");
return;
}
strExp = Server.HtmlEncode(Txt_Last.Text);
mc = Regex.Matches(Server.HtmlEncode(Txt_UrlSource.Text), strExp);
if (mc.Count > 1)
{
Response.Write("");
return;
}
}
上文就是关于信息采集程序的介绍,想要学习的朋友们,赶快把这篇文章收入囊中吧!希望对你的学习和工作有所帮助。
上一篇:asp防止刷新功能的实现代码
下一篇:重启虚拟主机的代码