接口地址:http://zhouxunwang.cn/data/?id=130 |
---|
返回格式:json |
请求方式:get |
请求示例:http://zhouxunwang.cn/data/?id=130&key=R5RTF4G5F5H6&trainno=G34 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
key | string | 必填 | 平台的KEY 扫码关注公众号 |
trainno | string | 必填 | 车次 |
名称 | 类型 | 说明 |
---|---|---|
trainno | string | 车次 |
type | string | 类型 |
sequenceno | string | 序号 |
station | string | 车站 |
day | string | 天数 |
arrivaltime | string | 到达时间 |
departuretime | string | 出发时间 |
stoptime | 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 | 硬座票价 |
{
"status": "0",
"msg": "ok",
"result": {
"trainno": "G34",
"type": "高铁",
"list": [{
"sequenceno": "1",
"station": "杭州东",
"day": "1",
"arrivaltime": "-",
"departuretime": "07:18",
"stoptime": "0",
"costtime": "0",
"distance": "0",
"isend": "0",
"pricesw": "",
"pricetd": "",
"pricegr1": "",
"pricegr2": "",
"pricerw1": "0.0",
"pricerw2": "0.0",
"priceyw1": "0.0",
"priceyw2": "0.0",
"priceyw3": "0.0",
"priceyd": "0.0",
"priceed": "0.0"
},
{
"sequenceno": "2",
"station": "湖州",
"day": "1",
"arrivaltime": "07:39",
"departuretime": "07:41",
"stoptime": "2",
"costtime": "21",
"distance": "71",
"isend": "0",
"pricesw": "",
"pricetd": "",
"pricegr1": "",
"pricegr2": "",
"pricerw1": "0.0",
"pricerw2": "0.0",
"priceyw1": "0.0",
"priceyw2": "0.0",
"priceyw3": "0.0",
"priceyd": "55.0",
"priceed": "32.5"
}
]
}
}
错误码 | 说明 |
---|---|
00000 | 没有该接口 |
00001 | 参数有空 |
00002 | key错误 |
00003 | 未办理过该业务 |
00004 | 条数不够 |
00005 | 已到期 |
00006 | 今天条数已用光 |
00007 | 您的账号不存在 |
201 | 车次为空 |
202 | 始发站或到达站为空 |
203 | 没有信息 |
101 | APPKEY为空或不存在 |
102 | APPKEY已过期 |
103 | APPKEY无请求此数据权限 |
104 | 请求超过次数限制 |
105 | IP被禁止 |
106 | IP请求超过限制 |
107 | 接口维护中 |
108 | 接口已停用 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2020/06/06 17:26
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'http://zhouxunwang.cn/data/?id=130&key=R5RTF4G5F5H6&trainno=G34';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "http://zhouxunwang.cn/data/?id=130&key=R5RTF4G5F5H6&trainno=G34"
)
func main() {
queryUrl := fmt.Sprintf("%s",APIURL)
resp, err := http.Get(queryUrl)
if err != nil {
log.Println(err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}