首页 交通出行 火车查询
火车查询

火车查询

  • 826
  • 6840
提供全国火车票时刻查询、火车站站查询、火车余票查询等3个接口,返回出发、到达时间、用时、票价、余票数量等信息。数据和12306同步。
750.00/50000次
申请就送50次
https://api.jisuapi.com/train/station2s
JSON,JSONP
GET POST
https://api.jisuapi.com/train/station2s?appkey=yourappkey&start=杭州&end=北京&ishigh=0

请求参数:

API在线测试
参数名称类型必填说明
start string 出发
end string 到达
ishigh int 是否高铁
date string 时间

返回参数:

参数名称类型说明
trainno string 车次
type string 类型
station string 出发站
endstation string 到达站
departuretime string 出发时间
arrivaltime string 到达时间
sequenceno string 顺序
costtime string 用时
distance string 距离
isend int 是否终点
pricesw string 商务座票价
pricetd string 特等座票价
pricegr1 string 高级软卧上票价
pricegr2 string 高级软卧下票价
pricerw1 string 软卧上票价
pricerw2 string 软卧下票价
priceyw1 string 硬卧上票价
priceyw2 string 硬卧中票价
priceyw3 string 硬卧下票价
priceyd string 一等座票价
priceed string 二等座票价
pricerz string 软座票价
priceyz string 硬座票价
typename string 火车类型
day string 行程天数
pricewz string 无座票价
priceqt string 其他座票价
pricedw string 动卧票价
pricedw1 string 高级动卧票价

请求代码:

查看代码
<?php

require_once 'curl.func.php';

$appkey = 'your_appkey_here';//你的appkey
$start = '杭州';//utf8
$end = '北京';//utf8
$ishigh = 0;
$url = "https://api.jisuapi.com/train/station2s?appkey=$appkey&start=$start&end=$end&ishigh=$ishigh";
$result = curlOpen($url, ['ssl'=>true]);
$jsonarr = json_decode($result, true);
//exit(var_dump($jsonarr));
if($jsonarr['status'] != 0)
{
    echo $jsonarr['msg'];
    exit();
}

foreach($jsonarr['result'] as $val)
{
    echo $val['trainno'].' '.$val['type'].' '.$val['station'].' '.$val['endstation'].' '.$val['departuretime'].' '.$val['arrivaltime'].'
'; }

JSON返回示例 :

{
    "status": 0,
    "msg": "ok",
    "result": [
        {
            "trainno": "G34",
            "type": "高铁",
            "station": "杭州东",
            "endstation": "北京南",
            "departuretime": "07:18",
            "arrivaltime": "13:07",
            "sequenceno": "1",
            "costtime": "5时49分",
            "distance": "1279",
            "isend": "1",
            "pricesw": "",
            "pricetd": "",
            "pricegr1": "",
            "pricegr2": "",
            "pricerw1": "0.0",
            "pricerw2": "0.0",
            "priceyw1": "0.0",
            "priceyw2": "0.0",
            "priceyw3": "0.0",
            "priceyd": "907.0",
            "priceed": "538.5"
        },
        {
            "trainno": "G32",
            "type": "高铁",
            "station": "杭州东",
            "endstation": "北京南",
            "departuretime": "08:30",
            "arrivaltime": "13:28",
            "sequenceno": "1",
            "costtime": "4时58分",
            "distance": "1279",
            "isend": "1",
            "pricesw": "",
            "pricetd": "",
            "pricegr1": "",
            "pricegr2": "",
            "pricerw1": "0.0",
            "pricerw2": "0.0",
            "priceyw1": "0.0",
            "priceyw2": "0.0",
            "priceyw3": "0.0",
            "priceyd": "907.0",
            "priceed": "538.5"
        }
    ]
}
                    

API错误码:

代号说明
201 车次为空
202 始发站或到达站为空
203 没有信息

系统错误码:

代号说明
101 APPKEY为空或不存在
102 APPKEY已过期
103 APPKEY无请求此数据权限
104 请求超过次数限制
105 IP被禁止
106 IP请求超过限制
107 接口维护中
108 接口已停用
计次套餐套餐规格价格
免费套餐 50次 0.00 元  ≈0元/次
Level3 50000次 750.00 元  ≈0.015元/次
Level4 100000次 1000.00 元  ≈0.01元/次

活动推荐ACTIVITY 更多

  • orc活动

其它推荐RECOMMENDED DATA 更多