接口地址:https://cn.apihz.cn/api/other/diming.php |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://cn.apihz.cn/api/other/diming.php?id=10006620&key=key&words=公交&radius=1000&lon=121.415&lat=31.218 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
id | int | 必填 | 用户中心的数字ID,例:id=10000000 |
key | string | 必填 | 对应平台秘钥,非本平台 扫码关注公众号 |
words | string | 必填 | 要查询的关键词 |
lon | float | 必填 | 查询经度 |
lat | float | 必填 | 查询纬度 |
名称 | 类型 | 说明 |
---|---|---|
datas.address | string | 地址。 |
datas.distance | string | 1千米以下单位为米(m),1千米以上单位为千米(km)。 |
datas.provinceCode | string | 省行政区编码,前缀带156,请自行去除。 |
datas.cityCode | string | 市行政区编码,前缀带156,请自行去除。 |
datas.county | string | 所属区县名称。 |
datas.typeName | string | 分类名称。 |
datas.source | string | 数据信息来源。 |
datas.lonlat | string | 坐标。 |
datas.typeCode | string | 分类编码。 |
datas.countyCode | string | 区县行政区编码,前缀带156,请自行去除。 |
datas.province | string | 所属省名称。 |
datas.poiType | string | 101:POI数据 102:公交站点。 |
datas.name | string | Poi点名称。 |
datas.hotPointID | string | poi热点ID。 |
datas.stationData | string | 车站数据集。 |
datas.stationData.stationUuid | string | 公交站uuid。 |
datas.stationData.lineName | string | 线路名称。 |
datas.stationData.uuid | string | 线路uuid。 |
{
"code": 200,
"count": "27",
"allpage": 1,
"nowpage": 1,
"datas": [{
"address": "上海市长宁区",
"distance": "240m",
"poiType": "102",
"name": "安化路定西路-公交站",
"source": "",
"hotPointID": "51644186BDC272E1",
"stationData": [{
"stationUuid": "1449946",
"lineName": "947路",
"uuid": "240424"
}],
"lonlat": "121.417121,31.216823"
}]
}
错误码 | 说明 |
---|---|
400 | 错误信息提示 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2025/4/20 07:11
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://cn.apihz.cn/api/other/diming.php?id=10006620&key=key&words=公交&radius=1000&lon=121.415&lat=31.218';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://cn.apihz.cn/api/other/diming.php?id=10006620&key=key&words=公交&radius=1000&lon=121.415&lat=31.218"
)
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))
}