转载自:http://www.cnblogs.com/waninlezu/archive/
2012/01/07/tran_ticket.html
https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date=2012-01-19&orderRequest.from_station_telecode=SHH&orderRequest.to_station_telecode=ZZF&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00
https://dynamic.12306.cn/otsweb/order/querySingleAction.do? method=queryLeftTicket &orderRequest.train_date=2012-01-18 &orderRequest.from_station_telecode=SHH &orderRequest.to_station_telecode=ZZF &orderRequest.train_no= &trainPassType=QB &trainClass=QB%23D%23Z%23T%23K%23QT%23 &includeStudent=00 &seatTypeAndNum= &orderRequest.start_time_str=00%3A00--24%3A00 "https://dynamic.12306.cn/otsweb/order/querySingleAction.do? method=queryLeftTicket &orderRequest.train_date=2012-01-19 &orderRequest.from_station_telecode=SHH &orderRequest.to_station_telecode=ZZF &orderRequest.train_no= &trainPassType=QB &trainClass=QB#D#Z#T#K#QT# &includeStudent=00 &seatTypeAndNum= &orderRequest.start_time_str=00:00--24:00"
此 URL 是 查询 指定日期 的 火车票 余票 状况.
预定 按钮 执行的 操作
提交 表单 函数
更具 以上 信息 构造表单
<form id="orderForm" method="post" action="/otsweb/order/querySingleAction.do?method=submutOrderRequest"> <input type="hidden" name="station_train_code" id="station_train_code"> <input type="hidden" name="train_date" id="train_date" value="2012-01-18"> <input type="hidden" name="seattype_num" id="seattype_num" value=""> <input type="hidden" name="from_station_telecode" id="from_station_telecode" value="SHH"> <input type="hidden" name="to_station_telecode" id="to_station_telecode" value="ZZF"> <input type="hidden" name="include_student" id="include_student" value="00"> <input type="hidden" name="from_station_telecode_name" id="from_station_telecode_name" value="上海"> <input type="hidden" name="to_station_telecode_name" id="to_station_telecode_name" value="郑州"> <input type="hidden" name="round_train_date" id="round_train_date" value="2012-01-27"> <input type="hidden" name="round_start_time_str" id="round_start_time_str" value="00:00--24:00"> <input type="hidden" name="single_round_type" id="single_round_type" value="2"> <input type="hidden" name="train_pass_type" id="train_pass_type" value="QB"> <input type="hidden" name="train_class_arr" id="train_class_arr" value="QB#D#Z#T#K#QT#"> <input type="hidden" name="start_time_str" id="start_time_str" value="00:00--24:00"> <!-- 获取具体车次的值 --> <input type="hidden" name="lishi" id="lishi"> <input type="hidden" name="train_start_time" id="train_start_time"> <input type="hidden" name="trainno" id="trainno"> <input type="hidden" name="arrive_time" id="arrive_time"> <input type="hidden" name="from_station_name" id="from_station_name"> <input type="hidden" name="to_station_name" id="to_station_name"> <input type="hidden" name="ypInfoDetail" id="ypInfoDetail"> <input type="Submit" name="submit" id = "submit"/> </form>
通过 修改 html 代码 嵌入 页面
做法 :
写 一个 循环., 监听
https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date=2012-01-19&orderRequest.from_station_telecode=SHH&orderRequest.to_station_telecode=ZZF&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00
发现 自己需要的 车 有票 则
提交表单.或发送短信.
此过程并无 验证码,前提是 你在登陆的 状态.
会自动 跳转到 Order 页面 下单,
剩下的 只有 靠 上帝保佑.