12306HTTP请求过程

打开购票查询页面:

+ 0.000            0.147    666    5737    GET    200    html    https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init

点击查询:

+ 0.000            0.217    986    9955    GET    200    html    https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryLeftTicket&orderRequest.train_date=2013-01-30&orderRequest.from_station_telecode=GZQ&orderRequest.to_station_telecode=SZQ&orderRequest.train_no=&trainPassType=QB&trainClass=D%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00%3A00--24%3A00

返回 车次列表:

0,<span id='id_65000D702104' class='base_txtdiv' onmouseover=javascript:onStopHover('65000D702104#GGQ#SZQ') onmouseout='onStopOut()'>D7021</span>,<img src='/otsweb/images/tips/first.gif'>&nbsp;&nbsp;&nbsp;&nbsp;广州东&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;06:30,<img src='/otsweb/images/tips/last.gif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;深圳&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;07:49,01:19,--,--,<font color='#008800'>有</font>,<font color='#008800'>有</font>,--,--,--,--,--,<font color='darkgray'>无</font>,--,<a name='btn130_2' class='btn130_2' style='text-decoration:none;' onclick=javascript:getSelected('D7021#01:19#06:30#65000D702104#GGQ#SZQ#07:49#广州东#深圳#01#05#8*****04887*****01318*****3000#1CDC1AAFE7F927A617390678D919927E9B25AC6052015A6A1260F955#Q2')>预&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订</a>\n1,<span id='id_65000D706510' class='base_txtdiv' onmouseover=javascript:onStopHover('65000D706510#GGQ#SZQ') onmouseout='onStopOut()'>D7065</span>,<img src='/otsweb/images/tips/first.gif'>&nbsp;&nbsp;&nbsp;&nbsp;广州东&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;07:00,<img src='/otsweb/images/tips/last.gif'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;深圳&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;08:19,01:19,--,--,<font color='#008800'>有</font>,<font color='#008800'>有</font>,--,--,--,--,--,<font color='darkgray'>无</font>,--,<a name='btn130_2' class='btn130_2' style='text-decoration:none;' onclick=javascript:getSelected('D7065#01:19#07:00#65000D706510#GGQ#SZQ#08:19#广州东#深圳#01#05#8*****04897*****01368*****3000#5E11A5B9FED18B33F812711A604B23DD32D8E91D8C0418CEC2EEABFA#Q2')>预&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订</a>


+ 0.012        !    0.032    778    341    GET    304    gif    https://dynamic.12306.cn/otsweb/dhtmlxGrid/codebase/imgs/pagination_loading.gif
+ 0.283        !    *    762    341    GET    304    gif    https://dynamic.12306.cn/otsweb/images/tips/first.gif
+ 0.298        !    *    762    341    GET    304    gif    https://dynamic.12306.cn/otsweb/images/tips/last.gif
+ 42.243            0.122    874    1098    GET    200    html    https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=queryaTrainStopTimeByTrainNo&train_no=65000D702104&from_station_telecode=GGQ&to_station_telecode=SZQ&depart_date=2013-01-30

返回:

[{"station_no":"01","station_name":"广州东","arrive_time":"----","start_time":"06:30","stopover_time":"----","isEnabled":true},{"station_no":"02","station_name":"石龙","arrive_time":"06:56","start_time":"06:58","stopover_time":"2分钟","isEnabled":true},{"station_no":"03","station_name":"东莞","arrive_time":"07:10","start_time":"07:12","stopover_time":"2分钟","isEnabled":true},{"station_no":"04","station_name":"樟木头","arrive_time":"07:20","start_time":"07:22","stopover_time":"2分钟","isEnabled":true},{"station_no":"05","station_name":"深圳","arrive_time":"07:49","start_time":"----","stopover_time":"----","isEnabled":true}]

选择一辆车点击预订

+ 0.000            0.333    1540    501    POST    302    重定向到 https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init    https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest

POST:

arrive_time    07:49    19   
from_station_name    广州东    45   
from_station_no    01    18   
from_station_telecode    GGQ    25   
from_station_telecode_name    广州    45   
include_student    00    18   
lishi    01:19    13   
locationCode    Q2    15   
mmStr    1CDC1AAFE7F927A617390678D919927E9B25AC6052015A6A1260F955    62   
round_start_time_str    00:00--24:00    37   
round_train_date    2013-01-30    27   
seattype_num        13   
single_round_type    1    19   
start_time_str    00:00--24:00    31   
station_train_code    D7021    24   
to_station_name    深圳    34   
to_station_no    05    16   
to_station_telecode    SZQ    23   
to_station_telecode_name    深圳    43   
train_class_arr    D#    20   
train_date    2013-01-30    21   
train_pass_type    QB    18   
train_start_time    06:30    24   
trainno4    65000D702104    21   
ypInfoDetail    8*****04887*****01318*****3000    43   

拼接之后:

station_train_code=D7021&train_date=2013-01-30&seattype_num=&from_station_telecode=GGQ&to_station_telecode=SZQ&include_student=00&from_station_telecode_name=%E5%B9%BF%E5%B7%9E&to_station_telecode_name=%E6%B7%B1%E5%9C%B3&round_train_date=2013-01-30&round_start_time_str=00%3A00--24%3A00&single_round_type=1&train_pass_type=QB&train_class_arr=D%23&start_time_str=00%3A00--24%3A00&lishi=01%3A19&train_start_time=06%3A30&trainno4=65000D702104&arrive_time=07%3A49&from_station_name=%E5%B9%BF%E5%B7%9E%E4%B8%9C&to_station_name=%E6%B7%B1%E5%9C%B3&from_station_no=01&to_station_no=05&ypInfoDetail=8*****04887*****01318*****3000&mmStr=1CDC1AAFE7F927A617390678D919927E9B25AC6052015A6A1260F955&locationCode=Q


+ 0.333            0.149    698    8206    GET    200    html    https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=init
+ 0.422        !    0.001    0    0    GET    (Cache)    css    https://dynamic.12306.cn/otsweb/css/style.css
+ 0.451        !    0.021    0    0    GET    (Cache)    css    https://dynamic.12306.cn/otsweb/css/suggest.css
+ 0.604        !    0.037    0    0    GET    (Cache)    javascript    https://dynamic.12306.cn/otsweb/js/common/jquery.validate.min.js?version=5.68
+ 0.684        !    0.031    0    0    GET    (Cache)    javascript    https://dynamic.12306.cn/otsweb/js/common/formCheck.js?version=5.68
+ 0.717        !    0.009    0    0    GET    (Cache)    javascript    https://dynamic.12306.cn/otsweb/js/order/constants_passenger_info.js?version=5.68
+ 0.777        !    0.004    0    0    GET    (Cache)    javascript    https://dynamic.12306.cn/otsweb/js/order/save_passenger_info.js?version=5.68
+ 1.040        !    0.082    682    3977    GET    200    jpeg    https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=randp
+ 1.098        !    *    762    341    GET    304    gif    https://dynamic.12306.cn/otsweb/images/tips/popdiv_2.gif
+ 1.123        !    0.020    762    1093    GET    200    gif    https://dynamic.12306.cn/otsweb/images/tips/popdiv_1.gif
+ 1.346        !    0.337    826    2239    POST    200    html    https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=getpassengerJson

post空

返回

{"passengerJson":[{"first_letter":"ZYQ","isUserSelf":"","mobile_no":"1332228355","old_passenger_id_no":"","old_passenger_id_type_code":"","old_passenger_name":"","passenger_flag":"0","passenger_id_no":"432222009142817","passenger_id_type_code":"1","passenger_id_type_name":"","passenger_name":"000","passenger_type":"1","passenger_type_name":"","recordCount":"5"},

选好乘客,提交订单:

+ 0.000        !    0.299    2164    506    POST    200    html    https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=checkOrderInfo&rand=QKZA

POST:

checkbox0    0    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
leftTicketStr    800795048870099501318007953000    44   
oldPassengers    黄卫平,1,43102142817    66   
oldPassengers        14   
oldPassengers        14   
oldPassengers        14   
oldPassengers        14   
orderRequest.bed_level_order_num    000000000000000000000000000000    63   
orderRequest.cancel_flag    1    26   
orderRequest.end_time    07:49    29   
orderRequest.from_station_name    广州东    58   
orderRequest.from_station_telecode    GGQ    38   
orderRequest.id_mode    Y    22   
orderRequest.reserve_flag    A    27   
orderRequest.seat_type_code        28   
orderRequest.start_time    06:30    31   
orderRequest.station_train_code    D7021    37   
orderRequest.ticket_type_order_num        35   
orderRequest.to_station_name    深圳    47   
orderRequest.to_station_telecode    SZQ    36   
orderRequest.train_date    2013-01-30    34   
orderRequest.train_no    65000D702104    34   
org.apache.struts.taglib.html.TOKEN    da88aa0b50aba73120474f4a4eb2f993    68   
passenger_1_cardno    4310209142817    37   
passenger_1_cardtype    1    22   
passenger_1_mobileno    13360078355    32   
passenger_1_name    黄平    44   
passenger_1_seat    7    18   
passenger_1_ticket    1    20   
passengerTickets    7,0,1,黄卫平,1,43109142817,1336055,Y    99   
randCode    QKZA    13   
textfield    中文或拼音首字母    82   
tFlag    dc    8   

拼接为

org.apache.struts.taglib.html.TOKEN=da88aa0b50aba73120474f4a4eb2f993&leftTicketStr=800795048870099501318007953000&textfield=%E4%B8%AD%E6%96%87%E6%88%96%E6%8B%BC%E9%9F%B3%E9%A6%96%E5%AD%97%E6%AF%8D&checkbox0=0&orderRequest.train_date=2013-01-30&orderRequest.train_no=65000D702104&orderRequest.station_train_code=D7021&orderRequest.from_station_telecode=GGQ&orderRequest.to_station_telecode=SZQ&orderRequest.seat_type_code=&orderRequest.ticket_type_order_num=&orderRequest.bed_level_order_num=000000000000000000000000000000&orderRequest.start_time=06%3A30&orderRequest.end_time=07%3A49&orderRequest.from_station_name=%E5%B9%BF%E5%B7%9E%E4%B8%9C&orderRequest.to_station_name=%E6%B7%B1%E5%9C%B3&orderRequest.cancel_flag=1&orderRequest.id_mode=Y&passengerTickets=7%2C0%2C1%2C%E9%BB%84%E5%8D%AB%E5%B9%B3%2C1%2C431027209142817%2C13360078355%2CY&oldPassengers=%E9%BB%84%E5%8D%AB%E5%B9%B3%2C1%2C431029009142817&passenger_1_seat=7&passenger_1_ticket=1&passenger_1_name=%E9%BB%84%E5%8D%AB%E5%B9%B3&passenger_1_cardtype=1&passenger_1_cardno=431027122142817&passenger_1_mobileno=128355&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&randCode=QKZA&orderRequest.reserve_flag=A&tFlag=dc

返回:

{"checkHuimd":"Y","check608":"Y","msg":"","errMsg":"Y"}


+ 0.309            0.073    890    538    GET    200    html    https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?

method=getQueueCount

&train_date=2013-01-30

&train_no=65000D702104

&station=D7021

&seat=7

&from=GGQ

&to=SZQ

&ticket=800795048870099501318007953000

返回{"countT":0,"count":0,"ticket":"8*****04887*****01318*****3000","op_1":false,"op_2":false}

页面提示:尊敬的旅客,本次列车您选择的席别尚有余票131张,特此提醒。

确定提交订单:

+ 0.000        !    0.208    2196    474    POST    200    html    https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=confirmSingleForQueue

POST:

checkbox0    0    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
leftTicketStr    800795048870099501318007953000    44   
oldPassengers    黄卫平,1,431027199009142817    66   
oldPassengers        14   
oldPassengers        14   
oldPassengers        14   
oldPassengers        14   
orderRequest.bed_level_order_num    000000000000000000000000000000    63   
orderRequest.cancel_flag    1    26   
orderRequest.end_time    07:49    29   
orderRequest.from_station_name    广州东    58   
orderRequest.from_station_telecode    GGQ    38   
orderRequest.id_mode    Y    22   
orderRequest.reserve_flag    A    27   
orderRequest.seat_type_code        28   
orderRequest.start_time    06:30    31   
orderRequest.station_train_code    D7021    37   
orderRequest.ticket_type_order_num        35   
orderRequest.to_station_name    深圳    47   
orderRequest.to_station_telecode    SZQ    36   
orderRequest.train_date    2013-01-30    34   
orderRequest.train_no    65000D702104    34   
org.apache.struts.taglib.html.TOKEN    3a729439cc39f26ed72fd888755ad366    68   
passenger_1_cardno    431027199009142817    37   
passenger_1_cardtype    1    22   
passenger_1_mobileno    13360078355    32   
passenger_1_name    黄卫平    44   
passenger_1_seat    7    18   
passenger_1_ticket    1    20   
passengerTickets    7,0,1,黄卫平,1,431027199009142817,13360078355,Y    99   
randCode    p9r9    13   
textfield    中文或拼音首字母    82   

org.apache.struts.taglib.html.TOKEN=3a729439cc39f26ed72fd888755ad366&leftTicketStr=800795048870099501318007953000&textfield=%E4%B8%AD%E6%96%87%E6%88%96%E6%8B%BC%E9%9F%B3%E9%A6%96%E5%AD%97%E6%AF%8D&checkbox0=0&orderRequest.train_date=2013-01-30&orderRequest.train_no=65000D702104&orderRequest.station_train_code=D7021&orderRequest.from_station_telecode=GGQ&orderRequest.to_station_telecode=SZQ&orderRequest.seat_type_code=&orderRequest.ticket_type_order_num=&orderRequest.bed_level_order_num=000000000000000000000000000000&orderRequest.start_time=06%3A30&orderRequest.end_time=07%3A49&orderRequest.from_station_name=%E5%B9%BF%E5%B7%9E%E4%B8%9C&orderRequest.to_station_name=%E6%B7%B1%E5%9C%B3&orderRequest.cancel_flag=1&orderRequest.id_mode=Y&passengerTickets=7%2C0%2C1%2C%E9%BB%84%E5%8D%AB%E5%B9%B3%2C1%2C431027199009142817%2C13360078355%2CY&oldPassengers=%E9%BB%84%E5%8D%AB%E5%B9%B3%2C1%2C431027199009142817&passenger_1_seat=7&passenger_1_ticket=1&passenger_1_name=%E9%BB%84%E5%8D%AB%E5%B9%B3&passenger_1_cardtype=1&passenger_1_cardno=431027199009142817&passenger_1_mobileno=13360078355&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&randCode=p9r9&orderRequest.reserve_flag=A

返回{"errMsg":"Y"}


+ 0.210            0.075    826    538    GET    200    html    https://dynamic.12306.cn/otsweb/order/myOrderAction.do?method=queryOrderWaitTime&tourFlag=dc


返回 {"tourFlag":"dc","waitTime":5,"waitCount":1,"requestId":5701674116250868781,"count":0}

等待时间 5,排队人数1

+ 4.220            0.063    826    570    GET    200    html    https://dynamic.12306.cn/otsweb/order/myOrderAction.do?method=queryOrderWaitTime&tourFlag=dc

返回{"tourFlag":"dc","waitTime":-1,"waitCount":0,"orderId":"E204716181","requestId":5701674116250868781,"count":0}

等待时间 5,排队人数1

排队完成提交订单:


+ 5.224            0.356    2180    7214    POST    200    html    https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=payOrder&orderSequence_no=E204716181

checkbox0    0    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
checkbox9    Y    11   
leftTicketStr    800795048870099501318007953000    44   
oldPassengers    黄卫平,1,431027199009142817    66   
oldPassengers        14   
oldPassengers        14   
oldPassengers        14   
oldPassengers        14   
orderRequest.bed_level_order_num    000000000000000000000000000000    63   
orderRequest.cancel_flag    1    26   
orderRequest.end_time    07:49    29   
orderRequest.from_station_name    广州东    58   
orderRequest.from_station_telecode    GGQ    38   
orderRequest.id_mode    Y    22   
orderRequest.reserve_flag    A    27   
orderRequest.seat_type_code        28   
orderRequest.start_time    06:30    31   
orderRequest.station_train_code    D7021    37   
orderRequest.ticket_type_order_num        35   
orderRequest.to_station_name    深圳    47   
orderRequest.to_station_telecode    SZQ    36   
orderRequest.train_date    2013-01-30    34   
orderRequest.train_no    65000D702104    34   
org.apache.struts.taglib.html.TOKEN    3a729439cc39f26ed72fd888755ad366    68   
passenger_1_cardno    431027199009142817    37   
passenger_1_cardtype    1    22   
passenger_1_mobileno    13360078355    32   
passenger_1_name    黄卫平    44   
passenger_1_seat    7    18   
passenger_1_ticket    1    20   
passengerTickets    7,0,1,黄卫平,1,431027199009142817,13360078355,Y    99   
randCode    p9r9    13   
textfield    中文或拼音首字母    82   

org.apache.struts.taglib.html.TOKEN=3a729439cc39f26ed72fd888755ad366&leftTicketStr=800795048870099501318007953000&textfield=%E4%B8%AD%E6%96%87%E6%88%96%E6%8B%BC%E9%9F%B3%E9%A6%96%E5%AD%97%E6%AF%8D&checkbox0=0&orderRequest.train_date=2013-01-30&orderRequest.train_no=65000D702104&orderRequest.station_train_code=D7021&orderRequest.from_station_telecode=GGQ&orderRequest.to_station_telecode=SZQ&orderRequest.seat_type_code=&orderRequest.ticket_type_order_num=&orderRequest.bed_level_order_num=000000000000000000000000000000&orderRequest.start_time=06%3A30&orderRequest.end_time=07%3A49&orderRequest.from_station_name=%E5%B9%BF%E5%B7%9E%E4%B8%9C&orderRequest.to_station_name=%E6%B7%B1%E5%9C%B3&orderRequest.cancel_flag=1&orderRequest.id_mode=Y&passengerTickets=7%2C0%2C1%2C%E9%BB%84%E5%8D%AB%E5%B9%B3%2C1%2C431027199009142817%2C13360078355%2CY&oldPassengers=%E9%BB%84%E5%8D%AB%E5%B9%B3%2C1%2C431027199009142817&passenger_1_seat=7&passenger_1_ticket=1&passenger_1_name=%E9%BB%84%E5%8D%AB%E5%B9%B3&passenger_1_cardtype=1&passenger_1_cardno=431027199009142817&passenger_1_mobileno=13360078355&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&oldPassengers=&checkbox9=Y&randCode=p9r9&orderRequest.reserve_flag=A


+ 5.444        !    0.001    0    0    GET    (Cache)        https://dynamic.12306.cn/otsweb/css/style.css
+ 5.544        !    0.025    746    1637    GET    200    javascript    https://dynamic.12306.cn/otsweb/js/common/time_count_down.js?version=5.68
+ 5.545        !    0.001    0    0    GET    (Cache)    javascript    https://dynamic.12306.cn/otsweb/js/common/jquery.validate.min.js?version=5.68
+ 5.548        !    0.113    762    2815    GET    200    javascript    https://dynamic.12306.cn/otsweb/js/integration/integration_pay.js?version=5.68
+ 5.551        !    0.043    746    4650    GET    200    gif    https://dynamic.12306.cn/otsweb/images/er/title_font7.gif
+ 5.551        !    0.050    746    1125    GET    200    gif    https://dynamic.12306.cn/otsweb/images/er/wxts.gif
+ 5.975        !    0.154    762    2820    GET    200    jpeg    https://dynamic.12306.cn/otsweb/sysuser/passCodeAction.do?rand=sjrand
+ 5.990        !    0.022    746    3013    GET    200    jpeg    https://dynamic.12306.cn/otsweb/images/date_bg.jpg
+ 6.008        !    0.018    746    645    GET    200    png    https://dynamic.12306.cn/otsweb/css/img/tabd_bg.png

原文地址:https://www.cnblogs.com/sung/p/2880920.html