求教,从网页获取数据

MeeGoo 2010-10-31 09:01:52
我想从http://www.500wan.com/pages/info/ssc/网站获取开奖数据,
请问怎么或者这种类型的网页的数据啊?
...全文
204 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
路人乙e 2010-11-01
  • 打赏
  • 举报
回复
最后一期开奖号码保存在一个XML文件:
http://jk.trade.500wan.com/static/public/ssc/xml/newlyopen.xml

内容如下:

<?xml version="1.0" encoding="utf-8" ?>
<xml>
<row expect="101101023" starttime="2010-11-01 01:50:00" endtime="2010-11-01 01:55:00" opentime="2010-11-01 01:55:00" opencode="5,2,1,4,3" order="23" />
</xml>
cjfriends 2010-11-01
  • 打赏
  • 举报
回复
从别人的网页获取数据还不会,学习了
xiaoyuan402 2010-11-01
  • 打赏
  • 举报
回复
抓取网页的html数据,然后用正则来匹配。获取你想要的数据即可
jingkunli 2010-11-01
  • 打赏
  • 举报
回复
远程加载,提取HTML所需要的内容!
liaoyukun111 2010-11-01
  • 打赏
  • 举报
回复
会用就行 深什么深呀
huangwenquan123 2010-11-01
  • 打赏
  • 举报
回复

string str = "http://www.500wan.com/pages/info/ssc/";
WebRequest wrq = WebRequest.Create(str);
WebResponse wrs = wrq.GetResponse();
using (StreamReader dr = new StreamReader(wrs.GetResponseStream(), Encoding.GetEncoding("utf-8")))
{
string content = dr.ReadToEnd();//这就是全部内容
//得到内容后根据正则获取你所需要的东西。要先分析他的html
}
using (StreamWriter sw = new StreamWriter(Server.MapPath(@"/default.htm"), false, Encoding.GetEncoding("utf-8")))
{
sw.WriteLine(content);
}
kokorenfeng 2010-11-01
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wuyq11 的回复:]
webclient
httpwebrequest抓取数据,正则获取特定数据
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; W……
[/Quote]
好深哦,学习,,,,看不懂,,,
yan19861206 2010-11-01
  • 打赏
  • 举报
回复
我想请问下你是不是要盗链?
hizhl168 2010-11-01
  • 打赏
  • 举报
回复
同 问。。。我也想知道,每次自己下的都不全
nitaiyoucala 2010-10-31
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wuyq11 的回复:]
webclient
httpwebrequest抓取数据,正则获取特定数据
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; W……
[/Quote]

+1
SoCsy 2010-10-31
  • 打赏
  • 举报
回复
查看HTML源文件,分析一下这个页面的结构,找到正确的URI,应该可以获得的
wuyq11 2010-10-31
  • 打赏
  • 举报
回复
webclient
httpwebrequest抓取数据,正则获取特定数据
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
System.Net.WebResponse response = request.GetResponse();
System.IO.Stream resStream = response.GetResponseStream();
System.IO.StreamReader sr = new System.IO.StreamReader(resStream, encoding);
string html = (sr.ReadToEnd());
resStream.Close();
sr.Close();

System.Net.WebClient wc = new System.Net.WebClient();
wc.Credentials = System.Net.CredentialCache.DefaultCredentials;
Byte[] pageData = wc.DownloadData(PageUrl);
string Content= System.Text.Encoding.Default.GetString(pageData);

62,271

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧