对了,最近遇到一个问题:
获取HTML源码,方法如下:
方法一: string netUrl = "http://store.taobao.com/shop/view_shop.htm?asker=wangwang&shop_nick=琳子68"
WebClient client = new WebClient();
byte[] page = client.DownloadData(netUrl);
string content = System.Text.Encoding.GetEncoding("gb2312").GetString(page);
方法二: string netUrl = "http://store.taobao.com/shop/view_shop.htm?asker=wangwang&shop_nick=琳子68";
HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(netUrl);
WebResponse resp = myWebRequest.GetResponse();
StreamReader oStreamRd = new StreamReader(resp.GetResponseStream(), Encoding.GetEncoding("GB2312"));
string content = oStreamRd.ReadToEnd();但是采用这两种方法所得到的html源代码和我通过浏览器:查看->源文件,得到的数据是不同的,方法得到的数据少了中间一段很长的数据,很奇怪.
所以问问大伙遇到这种问题没有,请指教,在线等,谢谢~~~
详见:http://topic.csdn.net/u/20090518/21/7839611c-3713-4c9b-b5a3-8237dbca8a78.html
http://topic.csdn.net/u/20090519/14/5c2e2d72-5427-443f-a890-c4939ebac6f4.html
获取HTML源码,方法如下:
方法一: string netUrl = "http://store.taobao.com/shop/view_shop.htm?asker=wangwang&shop_nick=琳子68"
WebClient client = new WebClient();
byte[] page = client.DownloadData(netUrl);
string content = System.Text.Encoding.GetEncoding("gb2312").GetString(page);
方法二: string netUrl = "http://store.taobao.com/shop/view_shop.htm?asker=wangwang&shop_nick=琳子68";
HttpWebRequest myWebRequest = (HttpWebRequest)WebRequest.Create(netUrl);
WebResponse resp = myWebRequest.GetResponse();
StreamReader oStreamRd = new StreamReader(resp.GetResponseStream(), Encoding.GetEncoding("GB2312"));
string content = oStreamRd.ReadToEnd();但是采用这两种方法所得到的html源代码和我通过浏览器:查看->源文件,得到的数据是不同的,方法得到的数据少了中间一段很长的数据,很奇怪.
所以问问大伙遇到这种问题没有,请指教,在线等,谢谢~~~
详见:http://topic.csdn.net/u/20090518/21/7839611c-3713-4c9b-b5a3-8237dbca8a78.html
http://topic.csdn.net/u/20090519/14/5c2e2d72-5427-443f-a890-c4939ebac6f4.html
http://shop35143815.taobao.com/
这个是一致的~~~
http://shop33665459.taobao.com/
是不一致的~~~
有一部分用户是可以的,有些是不行的,很奇怪,看不出来具体的差别再什么地方~~
应该不是JS问题,因为有些解析出来是一致的^_^
很简单的程序,估计2分钟左右~~~
自己写socket下载
有可能是因为Cookies不同造成的。