using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Net;
namespace mygrab
{
class china
{
static void Main(string[] args)
{
WebClient mywebclient = new WebClient();
mywebclient.Credentials = CredentialCache.DefaultCredentials; byte[] mybyte = mywebclient.DownloadData("http://61.135.173.47:6666/Outline.wct?Page=1&Result=96399&SelectID=8&ChannelID=4832&RecID=0");
string mystring = Encoding.Default.GetString(mybyte);
Regex re = new Regex(@"<td\scolspan=""2""><blockquote>[\s\S]*?""(?<web_url>[\s\S]*?)""");
MatchCollection mc = re.Matches(mystring);
int intnumber = 0;
foreach (Match m in mc)
{
intnumber++;
Console.WriteLine(intnumber );
Console.WriteLine(m.Groups["web_url"] );
}
Console.WriteLine(">>>>>");
Console.ReadLine();
}
}
}
这样居然不到数据……………………???搞不懂!,我的正则表达式没有问题啊!于是我把那个网址的源代码复制过来!然后把程序抓取入口改称本地路径也就是(localhost)数据就出来了!搞不懂!
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Net;
namespace mygrab
{
class china
{
static void Main(string[] args)
{
WebClient mywebclient = new WebClient();
mywebclient.Credentials = CredentialCache.DefaultCredentials; byte[] mybyte = mywebclient.DownloadData("http://61.135.173.47:6666/Outline.wct?Page=1&Result=96399&SelectID=8&ChannelID=4832&RecID=0");
string mystring = Encoding.Default.GetString(mybyte);
Regex re = new Regex(@"<td\scolspan=""2""><blockquote>[\s\S]*?""(?<web_url>[\s\S]*?)""");
MatchCollection mc = re.Matches(mystring);
int intnumber = 0;
foreach (Match m in mc)
{
intnumber++;
Console.WriteLine(intnumber );
Console.WriteLine(m.Groups["web_url"] );
}
Console.WriteLine(">>>>>");
Console.ReadLine();
}
}
}
这样居然不到数据……………………???搞不懂!,我的正则表达式没有问题啊!于是我把那个网址的源代码复制过来!然后把程序抓取入口改称本地路径也就是(localhost)数据就出来了!搞不懂!
解决方案 »
- 简单的三维数组问题,快来看
- 求一页面排版算法
- 使用冒泡排序时,提示数组越界,哪里出错?
- 请教问题
- 如果让WebBrowser控制不下载图片和FLASH等东西
- 请教个初级问题
- dataGridView1.Rows.Add(gridRow);当控件被数据绑定时,无法以编程方式向 DataGrid 该怎么解决
- 请问C#在编译的时候如何将dll或其他文件包进可执行文件中?
- 关于用C#调用在SQL Server2005创建以及处理挖掘模型的语句问题
- 正则表达式!!简单而又高分的问题!!!
- 分割字符串
- C#用ReadProcessMemory读出的字符怎么才能正常显示啊,读出的byte[]不能转换回中文字符的.
完全得到了我想要得结果!
怎么回事啊???