列車車次查詢-餘票查詢-Api介面
查介面找到的,分享給大家,希望對大家以後開發有用
火車車次查詢-餘票查詢--Api介面
1.來自12306的火車車次資料
火車票餘票查詢
http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=queryLeftTicket&orderRequest.train_date=2013-10-08&orderRequest.from_station_telecode=BJP&orderRequest.to_station_telecode=SHH&orderRequest.train_no=&trainPassType=QB&trainClass=QB%23D%23Z%23T%23K%23QT%23&includeStudent=00&seatTypeAndNum=&orderRequest.start_time_str=00:00--24:00
你測試該地址時,請修改日期查詢
上面的地址返回的資料格式如下:
{"datas":"0,G101<\/span>, 北京南
07:00, 上海虹橋
12:36,05:36,26,--,59,200,--,--,--,--,--,--,--,\\n1,G11<\/span>, 北京南
08:00, 上海虹橋
13:09,05:09,12,--,63,593,--,--,--,--,--,--,--,\\n2,G107<\/span>, 北京南
08:08, 上海虹橋
13:39,05:31,13,--,60,94,--,--,--,--,--,--,--,\\n3,D315<\/span>, 北京南
08:18, 上海虹橋
17:33,09:15,--,--,--,無<\/font>,--,--,--,--,--,19,--,\\n4,G1<\/span>, 北京南
09:00, 上海虹橋
13:48,04:48,24,--,101,526,--,--,--,--,--,--,--,\\n5,G113<\/span>, 北京南
09:05, 上海虹橋
14:29,05:24,20,--,108,43,--,--,--,--,--,--,--,\\n6,G115<\/span>, 北京南
09:16, 上海虹橋
14:48,05:32,26,--,79,261,--,--,--,--,--,--,--,\\n7,G41<\/span>, 北京南
09:33, 上海虹橋
15:08,05:35,22,--,89,15,--,--,--,--,--,--,--,\\n8,D317<\/span>, 北京南
09:38, 上海虹橋
18:28,08:50,--,--,--,147,--,3,--,--,--,51,--,\\n9,G13<\/span>, 北京南
10:00, 上海虹橋
14:55,04:55,26,--,107,369,--,--,--,--,--,--,--,\\n10,G117<\/span>, 北京南
10:05, 上海虹橋
15:29,05:24,--,10,56,60,--,--,--,--,--,--,--,\\n11,G119<\/span>, 北京南
10:45, 上海虹橋
16:19,05:34,8,--,68,87,--,--,--,--,--,--,--,\\n12,G15<\/span>, 北京南
11:00, 上海虹橋
15:55,04:55,12,--,67,300,--,--,--,--,--,--,--,\\n13,G121<\/span>, 北京南
11:05, 上海虹橋
16:42,05:37,13,--,70,156,--,--,--,--,--,--,--,\\n14,G125<\/span>, 北京南
11:35, 上海虹橋
17:13,05:38,--,10,62,106,--,--,--,--,--,--,--,\\n15,D319<\/span>, 北京南
11:40, 上海虹橋
20:52,09:12,--,--,無<\/font>,61,--,--,--,--,--,75,--,\\n16,1461<\/span>, 北京
11:58, 上海
08:08,20:10,--,--,--,--,--,--,無<\/font>,--,1084,254,--,\\n17,G129<\/span>, 北京南
12:04, 上海虹橋
17:41,05:37,23,--,91,229,--,--,--,--,--,--,--,\\n18,G131<\/span>, 北京南
12:28, 上海虹橋
18:04,05:36,13,--,74,195,--,--,--,--,--,--,--,\\n19,G133<\/span>, 北京南
12:49, 上海虹橋
18:18,05:29,25,--,113,200,--,--,--,--,--,--,--,\\n20,G135<\/span>, 北京南
13:07, 上海虹橋
18:44,05:37,25,--,84,173,--,--,--,--,--,--,--,\\n21,G3<\/span>, 北京南
14:00, 上海虹橋
18:48,04:48,24,--,106,401,--,--,--,--,--,--,--,\\n22,G43<\/span>, 北京南
14:05, 上海虹橋
19:34,05:29,20,--,82,51,--,--,--,--,--,--,--,\\n23,G139<\/span>, 北京南
14:16, 上海虹橋
19:47,05:31,25,--,118,269,--,--,--,--,--,--,--,\\n24,G141<\/span>, 北京南
14:22, 上海虹橋
19:55,05:33,26,--,116,474,--,--,--,--,--,--,--,\\n25,G143<\/span>, 北京南
14:43, 上海虹橋
20:27,05:44,26,--,121,572,--,--,--,--,--,--,--,\\n26,G17<\/span>, 北京南
15:00, 上海虹橋
19:59,04:59,25,--,104,562,--,--,--,--,--,--,--,\\n27,G145<\/span>, 北京南
15:29, 上海虹橋
21:07,05:38,13,--,79,595,--,--,--,--,--,--,--,\\n28,G19<\/span>, 北京南
16:00, 上海虹橋
21:12,05:12,24,--,101,565,--,--,--,--,--,--,--,\\n29,G147<\/span>, 北京南
16:10, 上海虹橋
21:42,05:32,2,--,27,586,--,--,--,--,--,--,--,\\n30,G21<\/span>, 北京南
17:00, 上海虹橋
22:29,05:29,26,--,115,523,--,--,--,--,--,--,--,\\n31,G153<\/span>, 北京南
17:05, 上海虹橋
22:42,05:37,26,--,121,667,--,--,--,--,--,--,--,\\n32,G157<\/span>, 北京南
17:32, 上海虹橋
22:59,05:27,13,--,80,763,--,--,--,--,--,--,--,\\n33,T109<\/span>, 北京
19:33, 上海
09:55,14:22,--,--,--,--,12,無<\/font>,無<\/font>,--,無<\/font>,123,--,\\n34,D313<\/span>, 北京南
19:34, 上海
07:15,11:41,--,--,--,69,無<\/font>,301,--,--,--,無<\/font>,--,\\n35,D311<\/span>, 北京南
21:16, 上海
08:58,11:42,--,--,--,239,--,258,--,--,--,12,--,\\n36,D321<\/span>, 北京南
21:22, 上海
09:04,11:42,--,--,--,287,--,239,--,--,--,12,--,","time":"13:40"}
得到上面的JSON資料,你只需要出來一下,該介面你就可以為你所用了。
查詢某天的所有列車車次
包含列車的名稱,發車時間和到車時間以及始發站和終點站
http://dynamic.12306.cn/otsquery/query/queryRemanentTicketAction.do?method=queryststrainall&date=2013-9-19&fromstation=BJP&tostation=SHH&starttime=00:00--24:00
同樣,你測試需要看看日期是否過時,是否是你想查的日期
返回的資料格式如下:
[{"end_station_name":"上海虹橋","end_time":"12:36","id":"240000G10103","start_station_name":"北京南","start_time":"07:00","value":"G101"},{"end_station_name":"上海虹橋","end_time":"13:09","id":"2400000G1106","start_station_name":"北京南","start_time":"08:00","value":"G11"},{"end_station_name":"上海虹橋","end_time":"13:39","id":"240000G10707","start_station_name":"北京南","start_time":"08:08","value":"G107"},{"end_station_name":"上海虹橋","end_time":"17:33","id":"240000D31509","start_station_name":"北京南","start_time":"08:18","value":"D315"},{"end_station_name":"上海虹橋","end_time":"14:13","id":"240000G10904","start_station_name":"北京南","start_time":"08:35","value":"G109"},{"end_station_name":"上海虹橋","end_time":"13:48","id":"24000000G106","start_station_name":"北京南","start_time":"09:00","value":"G1"},{"end_station_name":"上海虹橋","end_time":"14:29","id":"240000G11305","start_station_name":"北京南","start_time":"09:05","value":"G113"},{"end_station_name":"上海虹橋","end_time":"14:48","id":"240000G1150H","start_station_name":"北京南","start_time":"09:16","value":"G115"},{"end_station_name":"杭州","end_time":"16:17","id":"2400000G4102","start_station_name":"北京南","start_time":"09:33","value":"G41"},{"end_station_name":"上海虹橋","end_time":"18:28","id":"240000D31708","start_station_name":"北京南","start_time":"09:38","value":"D317"},{"end_station_name":"上海虹橋","end_time":"14:55","id":"2400000G1301","start_station_name":"北京南","start_time":"10:00","value":"G13"},{"end_station_name":"上海虹橋","end_time":"15:29","id":"240000G11700","start_station_name":"北京南","start_time":"10:05","value":"G117"},{"end_station_name":"上海虹橋","end_time":"16:19","id":"240000G11904","start_station_name":"北京南","start_time":"10:45","value":"G119"},{"end_station_name":"上海虹橋","end_time":"15:55","id":"2400000G1505","start_station_name":"北京南","start_time":"11:00","value":"G15"},{"end_station_name":"上海虹橋","end_time":"16:42","id":"240000G12106","start_station_name":"北京南","start_time":"11:05","value":"G121"},{"end_station_name":"上海虹橋","end_time":"17:13","id":"240000G1250J","start_station_name":"北京南","start_time":"11:35","value":"G125"},{"end_station_name":"上海虹橋","end_time":"20:52","id":"240000D31907","start_station_name":"北京南","start_time":"11:40","value":"D319"},{"end_station_name":"上海","end_time":"08:08","id":"24000014610T","start_station_name":"北京","start_time":"11:58","value":"1461"},{"end_station_name":"上海虹橋","end_time":"17:41","id":"240000G1290F","start_station_name":"北京南","start_time":"12:04","value":"G129"},{"end_station_name":"上海虹橋","end_time":"18:04","id":"240000G13105","start_station_name":"北京南","start_time":"12:28","value":"G131"},{"end_station_name":"上海虹橋","end_time":"18:18","id":"240000G13300","start_station_name":"北京南","start_time":"12:49","value":"G133"},{"end_station_name":"上海虹橋","end_time":"18:44","id":"240000G13503","start_station_name":"北京南","start_time":"13:07","value":"G135"},{"end_station_name":"上海虹橋","end_time":"18:48","id":"24000000G304","start_station_name":"北京南","start_time":"14:00","value":"G3"},{"end_station_name":"杭州東","end_time":"20:39","id":"2400000G4310","start_station_name":"北京南","start_time":"14:05","value":"G43"},{"end_station_name":"上海虹橋","end_time":"19:47","id":"240000G1390A","start_station_name":"北京南","start_time":"14:16","value":"G139"},{"end_station_name":"上海虹橋","end_time":"19:55","id":"240000G14103","start_station_name":"北京南","start_time":"14:22","value":"G141"},{"end_station_name":"上海虹橋","end_time":"20:27","id":"240000G1430A","start_station_name":"北京南","start_time":"14:43","value":"G143"},{"end_station_name":"上海虹橋","end_time":"19:59","id":"2400000G1705","start_station_name":"北京南","start_time":"15:00","value":"G17"},{"end_station_name":"上海虹橋","end_time":"21:07","id":"240000G1450A","start_station_name":"北京南","start_time":"15:29","value":"G145"},{"end_station_name":"上海虹橋","end_time":"21:42","id":"240000G14704","start_station_name":"北京南","start_time":"16:10","value":"G147"},{"end_station_name":"上海虹橋","end_time":"22:29","id":"2400000G2103","start_station_name":"北京南","start_time":"17:00","value":"G21"},{"end_station_name":"上海虹橋","end_time":"22:42","id":"240000G15304","start_station_name":"北京南","start_time":"17:05","value":"G153"},{"end_station_name":"上海虹橋","end_time":"22:59","id":"240000G15706","start_station_name":"北京南","start_time":"17:32","value":"G157"},{"end_station_name":"上海","end_time":"09:55","id":"240000T1090G","start_station_name":"北京","start_time":"19:33","value":"T109"},{"end_station_name":"上海","end_time":"07:15","id":"240000D31308","start_station_name":"北京南","start_time":"19:34","value":"D313"},{"end_station_name":"上海","end_time":"08:58","id":"240000D31110","start_station_name":"北京南","start_time":"21:16","value":"D311"},{"end_station_name":"上海","end_time":"09:04","id":"240000D32120","start_station_name":"北京南","start_time":"21:22","value":"D321"}]
2.來自新浪應用的介面資料
請註明資料來源:鐵路客戶服務中心 http://www.12306.cn/ 請支援友情連結:http://chepiao.sinaapp.com ********************************************************************************************** 說明:全部使用POST提交資料, 返回JSON字串. 介面地址:http://chepiao.sinaapp.com/api.php. 測試地址:http://chepiao.sinaapp.com/api.php?act=remain&startStation=%E4%B8%8A%E6%B5%B7&arriveStation=%E5%8C%97%E4%BA%AC&date=2012-01-01 ----------------------------------------------------------
1. 餘票&票價查詢:
Url: http://chepiao.sinaapp.com/api.php?act=remain Post: date: [yyyy-mm-dd OR yyyy/mm/dd OR yyyymmdd] startStation: 發站[中文 UTF8] arriveStation: 到站[中文 UTF8] Json: title: 資訊標題 station: 車站資訊 item: 車次資訊列表 trainCode: 序號 trainCode: 車次 startStation: 發站 arriveStation: 到站 startTime: 發時 endTime: 到時 takeTime: 歷時 mileage: 里程 hard-seat: 硬座(餘票) soft-seat: 軟座(餘票) hard-sleeper1: 硬臥上(餘票) hard-sleeper2: 硬臥中(餘票) hard-sleeper3: 硬臥下(餘票) soft-sleeper1: 軟臥上(餘票) soft-sleeper2: 軟臥下(餘票) best-seat: 特等座(餘票) one-seat: 一等座(餘票) two-seat: 二等座(餘票) vag-sleeper1: 高階軟臥上(餘票) vag-sleeper2: 高階軟臥下(餘票) none-seat: 無座(餘票) hard-seat-prc: 硬座(價格) soft-seat-prc: 軟座(價格) hard-sleeper1-prc: 硬臥上(價格) hard-sleeper2-prc: 硬臥中(價格) hard-sleeper3-prc: 硬臥下(價格) soft-sleeper1-prc: 軟臥上(價格) soft-sleeper2-prc: 軟臥下(價格) one-seat-prc: 一等座(價格) two-seat-prc: 二等座(價格) vag-sleeper1-prc: 高階軟臥上(價格) vag-sleeper2-prc: 高階軟臥下(價格) trainGrade: 等級 ----------------------------------------------------------2. 車次查詢:
Url: http://chepiao.sinaapp.com/api.php?act=code Post: trainCode: 車次[字母+數字] Json: title: 資訊標題 head: 頭部標題 item: 車次資訊 ----------------------------------------------------------3. 車站查詢:
Url: http://chepiao.sinaapp.com/api.php?act=station Post: stationName: 發站[中文 UTF8] Json: title: 資訊標題 station: 車站資訊 item: 車次資訊列表 trainCode: 車次 trainGrade: 等級 fromStation: 始發站 fromStime: 始發時間 toStation: 終到站 toStime: 終到時間 takeTime: 歷時 mileage: 里程 stationName: 車站 --------------------------------------------------------------4. 正晚點查詢:
Url: http://chepiao.sinaapp.com/api.php?act=schedule Post: stationName: 車站[中文 UTF8] trainCode: 車次[字母+數字] stationType: 型別[0:到達 1:出發] Json: title: 查詢到的正晚點資訊 --------------------------------------------------------------5. 機票查詢
Url: http://chepiao.sinaapp.com/api.php?act=plane Post: date: [yyyy-mm-dd OR yyyy/mm/dd OR yyyymmdd] departureAirport: 起飛[中文 UTF8] arrivalAirport: 到達[中文 UTF8] Json: title: 資訊標題 item: 資訊列表 flightCode: 航班號 carrierCom: 航空公司 planeType: 機型 departureTime: 起飛時間 arrivalTime: 降落時間 costTime: 飛行時間 departureAirport: 起飛機場 arrivalAirport: 降落機場 correctness: 準點率 delay: 平均延時相關文章
- 提供車輛出險報告查詢功能的API介面API
- IP查詢類API介面查詢,含各精度IP歸屬地查詢介面API
- 萬網域名查詢API介面API
- 快寶物流查詢API介面API
- 節假日查詢 API 介面上線API
- 車輛資訊快速查詢API:輕鬆查詢車牌號對應車輛的詳細資料API
- mysql查詢結果多列拼接查詢MySql
- PHP 快遞查詢介面,快遞鳥物流查詢 API 的二次封裝. 輕輕鬆鬆呼叫它PHPAPI封裝
- 各種免費好用的api,含天氣查詢、IP查詢、物流查詢等API
- Java API之查詢文件JavaAPI
- oracle查詢語句查詢增加一列內容Oracle
- SQL查詢的:子查詢和多表查詢SQL
- 免費API介面大全分享,含簡訊API、IP查詢API等API
- 陣列的查詢(搜尋):線性查詢和二分法查詢陣列
- 0629_層次查詢
- mysql-分組查詢-子查詢-連線查詢-組合查詢MySql
- 二維陣列查詢陣列
- 公積金餘額查詢電話
- 複雜查詢—子查詢
- 查詢——二分查詢
- 7.prometheus之查詢APIPrometheusAPI
- MYSQL學習筆記25: 多表查詢(子查詢)[標量子查詢,列子查詢]MySql筆記
- rails的介面查詢詳解AI
- HTML + CSS + JS 利用郵編查詢 API 實現郵編查詢工具HTMLCSSJSAPI
- 陣列的主元素查詢陣列
- 查詢演算法__Fibonacci查詢演算法
- group by,having查詢 ”每**“的查詢
- Elasticsearch複合查詢——boosting查詢Elasticsearch
- 常用快遞單號查詢api介面對接案例(快遞鳥api)API
- 全國省市區地址查詢API:簡單易用的地址查詢服務API
- 小米節假日API, 查詢調休API
- 通過Web API查詢資料WebAPI
- 離線查詢與線上查詢
- 查詢演算法__插值查詢演算法
- oracle 精確查詢和模糊查詢Oracle
- pgsql查詢優化之模糊查詢SQL優化
- MySQL - 資料查詢 - 簡單查詢MySql
- oracle資料庫sql查詢檢視第二次查詢很慢Oracle資料庫SQL
- 快遞物流查詢介面通用demo