您的位置:程序门 -> .net技术 -> c#



谁能告诉我怎么正确抓取带http压缩的网页?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


谁能告诉我怎么正确抓取带http压缩的网页?[已结贴,结贴人:wintle]
发表于:2007-03-31 01:09:17 楼主
http://bill.finance.sina.com.cn/bill/detail.php?stock_code=sh600578&bill_size=40000

这个地址,返回的是一个用gzip(deflate)压缩的流,如何正确解压???

能给个成功的代码吗?

引用icsharpcode.sharpziplib.dll   后,如何改造下面这些代码?

httpwebrequest   orequest   =   (httpwebrequest)webrequest.create(url);
orequest.useragent   =   "mozilla/4.0   (compatible;   msie   5.01;   windows   nt   5.0) ";
httpwebresponse   oresponse     =   (httpwebresponse)orequest.getresponse();
streamreader   sr   =   new   streamreader(oresponse.getresponsestream(),   system.text.encoding.getencoding( "gb2312 "));
//streamreader   sr   =   new   streamreader(oresponse.getresponsestream(),   system.text.encoding.default);
sresultcontents   =   sr.readtoend();
sr.close();
oresponse.close();

谢谢!
发表于:2007-03-31 08:09:581楼 得分:10
gzip用.net自己的可以解压了。
发表于:2007-03-31 08:44:092楼 得分:10
http://www.az2007.net/html/aspnet/2006-12/5/101802525.html
发表于:2007-03-31 09:05:533楼 得分:10
mark
发表于:2007-03-31 09:11:444楼 得分:60
没有试过,但是很有意思,我先找看,搞好在回帖,呵呵.
发表于:2007-03-31 11:18:195楼 得分:0
谢谢各位!我用的是.net   framework   1.1的。。。
发表于:2007-04-01 09:05:466楼 得分:10
up
发表于:2007-04-01 11:30:147楼 得分:0
高人们,给点建议啊。。
发表于:2007-04-01 14:14:258楼 得分:0
啥意思,不懂唉
发表于:2007-04-02 22:17:069楼 得分:0
谢谢各位了,这里是正解:
http://www.icsharpcode.net/opensource/sd/forum/topic.asp?topic_id=893



快速检索

最新资讯
热门点击