接口地址:https://v2.alapi.cn/api/kd |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://v2.alapi.cn/api/kd?number=560006690892&token=token |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
token | string | 必填 | 请求token 扫码关注公众号 |
number | string | 必填 | 快递编号 |
com | string | 选填 | 快递公司编号 |
名称 | 类型 | 说明 |
---|---|---|
- | - | - |
{
"code": 200,
"msg": "success",
"data": {
"status": 1,
"nu": "560006690892",
"com": "lianhaowuliu",
"state": "0",
"info": [{
"time": "2019-09-27 10:51:29",
"content": "[那曲市]到达【那曲邮政处理中心】"
},
{
"time": "2019-09-27 04:47:30",
"content": "[拉萨市]离开【拉萨邮区中心局邮件处理中心】,下一站【那曲邮政处理中心】(经转)"
},
{
"time": "2019-09-26 15:36:40",
"content": "[拉萨市]到达【航空邮件处理中心】(经转)"
},
{
"time": "2019-09-26 02:28:57",
"content": "[北京市]离开【北京航站】,下一站【航空邮件处理中心】"
},
{
"time": "2019-09-25 22:06:30",
"content": "[北京市]到达【新顺中心】"
},
{
"time": "2019-09-25 21:08:11",
"content": "[北京市]离开【中关村区域商企中心】,下一站【新顺中心】"
},
{
"time": "2019-09-25 21:00:10",
"content": "[北京市]【中关村区域商企中心】已收件,揽投员:朱云麟,电话:18519361874"
}
]
},
"Author": {
"name": "Alone88",
"desc": "由Alone88提供的免费API 服务,官方文档:www.alapi.cn"
}
}
错误码 | 说明 |
---|---|
500 | 处理异常 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2020/02/01 00:16
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://v1.alapi.cn/api/kd?number=560006690892';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://v1.alapi.cn/api/kd"
)
func main() {
queryUrl := fmt.Sprintf("%s?number=560006690892",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))
}