请问,这样写有没有问题???
1 string parm = "beginDate=" + date + "&endDate=" + date + "&spnrtype=ALL&sstatus=ALL&refund_status=ALL&booking_no=" + pnr + "&bank_order_no=&usrid=&tickettype=ALL&ettype=ALL&isrefund=1&ismuerrorrefund=1&pnrtype=&actiontype=query&subtpList="; 2 HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://mu.travelsky.com/muair/servlet/com.muet.model.login.LoginServlet?" + logString); 3 request.Accept = "*/*"; 4 request.Method = "POST"; 5 request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)"; 6 response.Cookies = cc.GetCookies(request.RequestUri); 7 request.CookieContainer = cc; 8 request.KeepAlive = true; 9 request.Referer = "http://mu.travelsky.com/muair/Query/front/pnrquery.jsp";10 byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(parm);11 request.ContentLength = bytes.Length;12 request.ContentType = "application/x-www-form-urlencoded";13 14 Stream stream = request.GetRequestStream();15 stream.Write(bytes,0,bytes.Length);16 stream.Close();17 18 HttpWebResponse response = (HttpWebResponse)request.GetResponse();19 response.Cookies = cc.GetCookies(request.RequestUri);20 request.CookieContainer = cc;21 22 StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default);23 string content = reader1.ReadToEnd();24 reader.Close();
- 2 回答
- 0 关注
- 463 浏览
添加回答
举报
0/150
提交
取消