参数名称 | 类型 | 必填 | 说明 |
---|---|---|---|
start | string | 是 | 出发 |
end | string | 是 | 到达 |
ishigh | int | 否 | 是否高铁 |
参数名称 | 类型 | 说明 |
---|---|---|
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 | 硬座票价 |
<?php require_once 'curl.func.php'; $appkey = 'your_appkey_here';//你的appkey $start = '杭州';//utf8 $end = '北京';//utf8 $ishigh = 0; $url = "https://api.binstd.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'].'
'; }
{ "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" } ] }
代号 | 说明 |
---|---|
201 | 车次为空 |
202 | 始发站或到达站为空 |
203 | 没有信息 |
代号 | 说明 |
---|---|
101 | APPKEY为空或不存在 |
102 | APPKEY已过期 |
103 | APPKEY无请求此数据权限 |
104 | 请求超过次数限制 |
105 | IP被禁止 |
106 | IP请求超过限制 |
107 | 接口维护中 |
108 | 接口已停用 |
会员等级 | 权限 |
---|---|
普通用户 | 100次 |
会员 | 不限次 |
技术代理 | 不限次 |
开通账号: