| 参数名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
| start | string | 是 | 出发城市 |
| end | string | 是 | 到达城市 |
| 参数名称 | 类型 | 说明 |
|---|---|---|
| startcity | string | 出发城市 |
| endcity | string | 到达城市 |
| startstation | string | 出发车站 |
| endstation | string | 到达车站 |
| starttime | string | 出发时间 |
| price | string | 票价 |
| bustype | string | 车型 |
| distance | string | 距离 |
<?php
require_once 'curl.func.php';
$appkey = 'your_appkey_here';//你的appkey
$start = '杭州';//utf8
$end = '上海';//utf8
$url = "https://api.binstd.com/bus/city2c?appkey=$appkey&start=$start&end=$end";
$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['startcity'].' '.$val['endcity'].' '.$val['startstation'].' '.$val['endstation'].' '.$val['starttime'].' '.$val['price'].' '.$val['bustype'].' '.$val['distance'].'
';
}
{
"status": "0",
"msg": "ok",
"result": [
{
"startcity": "杭州",
"endcity": "上海",
"startstation": "客运中心站",
"endstation": "上海",
"starttime": "06:50",
"price": "68",
"bustype": "大高3",
"distance": "181"
},
{
"startcity": "杭州",
"endcity": "上海",
"startstation": "客运中心站",
"endstation": "上海南站",
"starttime": "07:10",
"price": "68",
"bustype": "大高3",
"distance": "181"
},
{
"startcity": "杭州",
"endcity": "上海",
"startstation": "杭州南站",
"endstation": "上海南站",
"starttime": "07:10",
"price": "68",
"bustype": "大高2",
"distance": "181"
}
]
}
| 代号 | 说明 |
|---|---|
| 201 | 出发或到达城市为空 |
| 202 | 城市为空 |
| 203 | 没有信息 |
| 代号 | 说明 |
|---|---|
| 101 | APPKEY为空或不存在 |
| 102 | APPKEY已过期 |
| 103 | APPKEY无请求此数据权限 |
| 104 | 请求超过次数限制 |
| 105 | IP被禁止 |
| 106 | IP请求超过限制 |
| 107 | 接口维护中 |
| 108 | 接口已停用 |
| 名称 | 权限 | 价格 | |
|---|---|---|---|
| 免费套餐 | 5次 | 免费 | |
| Level1 | 30000次 | 230.00元 | |
| Level2 | 50000次 | 375.00元 | |
| Level3 | 100000次 | 725.00元 |
开通账号: