go-home(一款針對12306的火車票訂票軟體)源碼分析

來源:互聯網
上載者:User

項目地址:http://code.google.com/p/go-home/,原始碼svn地址: http://go-home.googlecode.com/svn/trunk/

去年出的一款比較老的訂票軟體,現在可能已經失效了,只是拿來學習下基本的訂票流程,方便對其他訂票指令碼的研究。

基本流程圖:

1,擷取圖片驗證碼

提交請求給https://dynamic.12306.cn/otsweb/passCodeAction.do?rand=sjrand,

2,擷取登陸時使用的隨機數,

提交請求給https://dynamic.12306.cn/otsweb/loginAction.do?method=loginAysnSuggest,

3,使用者登陸,提交請求給https://dynamic.12306.cn/otsweb/loginAction.do,若登陸成功,在登陸的cookie中,會有JSESSIONID和BIGipServerotsweb這兩個資訊,這兩個變數值可以儲存下來。

cookie:JSESSIONID=6009B4610F436D8023126256FB598BDD;BIGipServerotsweb=2413035786.48160.0000

4,查詢合格車次資訊,

提交請求給https://dynamic.12306.cn/otsweb/order/querySingleAction.do,

5,對查詢到的車次資訊進行判斷,找到合適的車次,看是否有合適的席別,

6,預定車票,提交請求給

https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=submutOrderRequest,

7,擷取令牌,提交請求給

https://dynamic.12306.cn/otsweb/order/querySingleAction.do?method=init

8,拿上擷取到的令牌,提交訂單,提交請求給

https://dynamic.12306.cn/otsweb/order/confirmPassengerAction.do?method=confirmPassengerInfoSingle

9,查詢訂單狀態。提交請求給

https://dynamic.12306.cn/otsweb/order/myOrderAction.do?method=queryMyOrderNotComplete

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.