你的问题倒是看清楚了,这个网站的分页是采用POST,进行分页的,所以你看不到页码.
因此,你要采集第二页以上的数据就要用POST把页码发送过去.你查看源代码,会发现里面有这么一句:<input type="hidden" name="page" value="1"/>
很显然,这就是当前页码.所以只要把这个值+1,再Post发送,就可以了.仅提供思路.
因此,你要采集第二页以上的数据就要用POST把页码发送过去.你查看源代码,会发现里面有这么一句:<input type="hidden" name="page" value="1"/>
很显然,这就是当前页码.所以只要把这个值+1,再Post发送,就可以了.仅提供思路.
// postData += "&__EVENTVALIDATION="+System.Web.HttpContext.Current.Server.UrlEncode("/wEWBgK1y42BCwLc3tynBALc3uCnBALc3tSnBALc3tinBAKmp46bBAtocAmNR1c0tmcUJP+o2bkbnddh");
string postData = "ctl00$ContentPlaceHolder1$TextBox0=";
postData += "&ctl00$ContentPlaceHolder1$TextBox1=北京";// +System.Web.HttpContext.Current.Server.UrlEncode("");
postData += "&ctl00$ContentPlaceHolder1$TextBox2=上海";
postData += "&ctl00$ContentPlaceHolder1$TextBox3=";
postData += "&ctl00$ContentPlaceHolder1$SearchBtn=查询";
postData += "&page=2";
postData += "&t=-1"; byte[] data = System.Text.Encoding.UTF8.GetBytes(postData);
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://huoche.name/TicketList.aspx");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
System.IO.Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
System.IO.StreamReader reader = new System.IO.StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string content=reader.ReadToEnd();
textBox1.Text = content;总共多少页,我也没发现.