| 接口地址:https://api.lolimi.cn/API/hc/api |
|---|
| 返回格式:json |
| 请求方式:get/post |
| 请求示例:https://api.lolimi.cn/API/hc/api?departure=北京&arrival=上海&type=json |
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 必填 | json/text默认text;departure |
| 名称 | 类型 | 说明 |
|---|---|---|
| TrainNumber | string | 列车车次 |
| start | string | 出发地 |
| end | string | 终点 |
| DepartTime | string | 出发时间 |
| ArriveTime | string | 到达时间 |
| SeatList | arr | 座位信息 |
{
"code": 200,
"count": 1,
"go": "合肥",
"to": "上海",
"form": "",
"time": "2026-01-24 21:11:12",
"date": "2026-01-24",
"data": [{
"TrainNumber": "K8361",
"start": "合肥",
"end": "上海",
"DepartTime": "22:35",
"ArriveTime": "08:09",
"TimeDifference": "14:26",
"SeatList": [{
"SeatName": "硬座",
"SeatPrice": 78,
"Seatresidue": 99
},
{
"SeatName": "硬卧",
"SeatPrice": 148,
"Seatresidue": 99
},
{
"SeatName": "软卧",
"SeatPrice": 223,
"Seatresidue": 4
},
{
"SeatName": "无座",
"SeatPrice": 78,
"Seatresidue": 99
}
]
}],
"timestamp": 1769262315,
"author": "桑帛云API:https://api.lolimi.cn",
"exec_time": "191ms"
}| 错误码 | 说明 |
|---|---|
| - | - |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2026/1/20 07:11
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://api.lolimi.cn/API/hc/api?departure=北京&arrival=上海&type=json';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://api.lolimi.cn/API/hc/api?departure=北京&arrival=上海&type=json"
)
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))
}