[Pin to top] How to Use the API for Ticket remaining ticket

Source: Internet
Author: User

Previously, many people and the APIs that I used to call the ticket clearance interface were frequently updated by the Ministry of Railways, which led to the failure of the ticket clearance data. See the article:

When the Spring Festival is approaching, I made an interface for querying the train ticket remaining. The source of the ticket remaining is 12306. The figure is Baidu map,

Although this is called the train ticket surplus interface, I am very sorry that this interface still does not obtain the ticket surplus data, however, this interface can obtain some common train information (see the descriptions below)

API usage

Copyright Disclaimer: The train ticket data comes from 12306.cn. if there is any infringement, please contact and I will delete it as soon as possible.

QQ chat group: 153856687,198110186

Interface Description:

Supports the post/get method to submit data and return data in JSON format. In addition, keep the utf8 format

  1. Querying the train information of the remaining ticket

Query URL format:

12306.php10086.com/yupiao.php? Act = remain & arrivestation = Shanghai & date = 2012-02-02 & startstation = Hangzhou

Parameter format:

Act, which is the query type. Remain indicates that it is the query type of the remaining ticket.

Date: [yyyy-mm-dd format]
Startstation: [Chinese utf8]
Arrivestation: Arrival [Chinese utf8]

JSON data description:

Title: Information title
Station: Station Information
Item: vehicle count Information List
Traincode: serial number
Traincode: Train count
Arrivestation: Arrival
Starttime: sending time
Endtime: then
Taketime: Duration
Mileage: mileage
Hard_seat_prc: hard seat (price)
Soft_seat_prc: soft seat (price)
Hard_sleeper1_prc: hard sleeper (price)
Hard_sleeper2_prc: hard sleeper (price)
Hard_sleeper3_prc: hard sleeper (price)
Soft_sleeper1_prc: Soft Sleeper (price)
Soft_sleeper2_prc: Soft Sleeper (price)
One_seat_prc: first-class seat (price)
Two_seat_prc: second-class seat (price)
Vag_sleeper1_prc: premium soft sleeper (price)
Vag_sleeper2_prc: premium soft sleeper (price)
Traingrade: Grade

Remaining ticket field: (PS: no value for the data currently)


Hard_seat: hard seat (remaining ticket)
Soft_seat: soft seat (remaining ticket)
Hard_sleeper1: hard sleeper (remaining ticket)
Hard_sleeper2: hard sleeper (remaining ticket)
Hard_sleeper3: hard sleeper (remaining ticket)
Soft_sleeper1: Soft Sleeper (remaining ticket)
Soft_sleeper2: Soft Sleeper (remaining ticket)
Best_seat: special seat (remaining ticket)
One_seat: first-class seat (remaining ticket)
Two_seat: second-class seat (remaining ticket)
Vag_sleeper1: advanced soft sleeper (remaining ticket)
None_seat: no seat (remaining ticket)



Train number query

Vehicle count query:
URL: http://12306.php10086.com/yupiao.php? Act = Code & traincode = d3106

Act, which is the query type. Code indicates the vehicle Query type.

Traincode: number of trains [letters + numbers]
Title: Information title
Head: Head title
Item: vehicle count Information

Plane ticket Query

URL: http://12306.php10086.com/yupiao.php? Act = plane & arrivalairport = Beijing & date = 2012-02-19 & departureairport = Shanghai

Act, which is the query type. Plane indicates the ticket Query type.

Date: [yyyy-mm-dd]
Departureairport: departure [Chinese utf8]
Arrivalairport: arrived at [Chinese utf8]


JSON data:

Title: Information title
Item: Information List
Flightcode: Flight number
Carriercom: Airline
Planetype: Model
Departuretime: departure time
Arrivaltime: arrival time
Costtime: Flight Time
Departureairport: departure airport
Arrivalairport: arrival airport
Correctness: punctuality Rate
Delay: average latency

Technorati label: train ticket interface, ticket interface, ticket interfaceapi

Link to this article: How to Use the Ticket remaining ticket API
Contact Author: PhP Huaibei, chat QQ Group: Group 1: 153856687, group 2: 198110186
All Rights Reserved: non-special statements are original articles on this site. For details, refer to php10086 blog.
Subscribe to updates: Welcome to subscribe to our content updates through RSS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.