[12306] login process and interface description

Key:

Relates to all of the following parameters with the request, should be set Content-Type: application / x-www-form-urlencoded or thrown into the URL parameter

 

First, access code picture

url:https://kyfw.12306.cn/passport/captcha/captcha-image

type:post/get

param:

{
    "login_site" : "E",    //非必须(鬼知道这些参数是什么意思)
    "module" : "login",    //非必须
    "rand" : "sjrand",     //非必须
}

the Result :( similar to the following picture)

 

Second, the check codes

url:https://kyfw.12306.cn/passport/captcha/captcha-check

type:post/get

param:

{
    "login_site" : "E",    //非必须(鬼知道这些参数是什么意思)
    "rand" : "sjrand",     //非必须
    "answer" : "180,110,250,110",    //点击图片的位置
}

result:

{
    "result_message": "验证码校验成功",
    "result_code": "4"
}

answer Parameter Description

The following figure as an example:

The official practice is to add event listeners to click pictures

var code_arr = [];
$("#txx_img").on('click',function(event){
    var x = event.offsetX; //图片点击点x偏移量(从左到右)
    var y = event.offsetY - 30; //图象点击点y偏移量 (从上到下),减30是去掉验证码上提示信息的高度
    code_arr.push( x + ","+ y ); //arr是全局存储验证码点击数据的变量
})

//最后提交时,把数据拼装起来
var answer = code_arr.join(',');

When their own test interface can be calculated using the micro-channel capture tool x, y and then put together submission, (remember some tips from the text below began to count !!!)

Third, the user logs

url:http://kyfw.12306.cn/passport/web/login

type:post/get

param:

{
    "username" : "13622632263",    //必须 用户名
    "password" : "shuishishuishabi",     //必须 密码
    "appid" : "otn",    //必填(鬼知道是啥玩意) 
}

result:

{
    "result_message": "登录失败",
    "result_code": 1
}

Below? Not below, temporarily ended in failure, the browser also account registration does not go, do not know is the title

Someday become continue

Published 35 original articles · won praise 18 · views 370 000 +

Guess you like

Origin blog.csdn.net/TXX_c/article/details/82315603