现在有一个网页(大家放心此网站不会有毒di):
http://partsurfer.hp.com/Search.aspx?searchText=432320-001当打开此网页后,点击网页中部的黄色区域(标注有Click here的区域)将展开一个类似的列表,此列表中的内容正是我想获取的。但这些个列表内容,从网页的源代码中没有找到。问题来了,通过什么方法可以获取到!有劳各位大侠!!!
http://partsurfer.hp.com/Search.aspx?searchText=432320-001当打开此网页后,点击网页中部的黄色区域(标注有Click here的区域)将展开一个类似的列表,此列表中的内容正是我想获取的。但这些个列表内容,从网页的源代码中没有找到。问题来了,通过什么方法可以获取到!有劳各位大侠!!!
: string phoneNum = tbPhoneNum.Text;
try
{
//web客户端
WebClient webclient = new WebClient();
//下载数据
string str_ = webclient.DownloadString("http://www.ip138.com:8080/search.asp?mobile=" + phoneNum + "&action=mobile");
//正则
string str_regex = "><!-- <td></td> -->.*</TD>";
//忽略大小写
Regex regex = new Regex(str_regex, RegexOptions.IgnoreCase);
//开始匹配
MatchCollection matchCollection = regex.Matches(str_); txtAddress.Text = "卡归属地:" + matchCollection[0].Value.Replace("><!-- <td></td> -->","").Replace("</TD>","").Replace(" ",","); txtType.Text = "卡类型:" + matchCollection[1].Value.Replace("><!-- <td></td> -->", "").Replace("</TD>", "");
}
catch (Exception ex) { }
上面的是使用拿下网页信息,然后用正则过滤出自己要的内容。