public void setDefalutTag(HtmlForm form) { foreach (KeyValue kv in defaultKeyValue) { form.setTagValue(kv.Key, kv.Value); } }
private void yuding(string commitstr) { string yuanshi = @"station_train_code#K558 train_date#2013-02-06 seattype_num# from_station_telecode#ZZF to_station_telecode#SHH include_student#00 from_station_telecode_name#郑州 to_station_telecode_name#上海 round_train_date#2013-02-07 round_start_time_str#00:00--24:00 single_round_type#1 train_pass_type#QB train_class_arr#QB#D#Z#T#K#QT# start_time_str#00:00--24:00 lishi#13:15 train_start_time#00:30 trainno4#4a0000K5590D arrive_time#13:45 from_station_name#郑州 to_station_name#上海 from_station_no#07 to_station_no#18 ypInfoDetail#1*****30024*****00001*****00003*****0002 mmStr#B1F8667617E02CC7B0712C6A22C1DB50DC6242E7103476AD921D8959 locationCode#Y1"; HtmlForm form = new HtmlForm(new Uri("https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest")); form.Referer = "https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init"; StringReader reader = new StringReader(yuanshi); string line = null; while ((line = reader.ReadLine()) != null) { string[] tags = line.Split('#'); form.setTagValue(tags[0], tags[1]); } //form.setTagValue("station_train_code", "K558"); //form.setTagValue("train_date", "2013-02-06"); //form.setTagValue("seattype_num", ""); //form.setTagValue("from_station_telecode", "ZZF"); //form.setTagValue("to_station_telecode", "SHH"); //form.setTagValue("include_student", "00"); //form.setTagValue("from_station_telecode_name", "郑州"); //form.setTagValue("to_station_telecode_name", "上海"); //form.setTagValue("round_train_date", "2013-02-07"); //form.setTagValue("round_start_time_str", "00:00--24:00"); //form.setTagValue("single_round_type", "1"); //form.setTagValue("train_pass_type", "QB"); //form.setTagValue("train_class_arr", "QB#D#Z#T#K#QT#"); //form.setTagValue("start_time_str", "00:00--24:00"); //form.setTagValue("lishi", "13:15"); //form.setTagValue("train_start_time", "00:30"); //form.setTagValue("from_station_name", "上海"); //form.setTagValue("from_station_name", "上海"); //form.setTagValue("from_station_name", "上海"); //form.setTagValue("to_station_no", "18"); //form.setTagValue("station_train_code", "K558"); reader.Close(); string[] commsp = commitstr.Split('#'); form.setTagValue("station_train_code", commsp[0]); form.setTagValue("lishi", commsp[1]); form.setTagValue("train_start_time", commsp[2]); form.setTagValue("trainno4", commsp[3]); form.setTagValue("from_station_telecode", commsp[4]); form.setTagValue("to_station_telecode", commsp[5]); form.setTagValue("arrive_time", commsp[6]); form.setTagValue("from_station_telecode_name", commsp[7]); form.setTagValue("to_station_telecode_name", commsp[8]); form.setTagValue("from_station_no", commsp[9]); form.setTagValue("to_station_no", commsp[10]); form.setTagValue("ypInfoDetail", commsp[11]); form.setTagValue("mmStr", commsp[12]); form.setTagValue("locationCode", commsp[13]); string res= form.post(); res = getText("https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init"); //res = getText("https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init"); setText(res); }