无需授权和配置, 简单便捷查询运单快递信息
- PHP >= 7.0
$ composer require wythe/logistics -vvv
use Wythe\Logistics\Logistics
$logistics = new Logisitics()
$logistics->getLogisticsByName('12313131231'); // 第二参数不设,则默认快递100接口
$logistics->getLogisticsByName('12313131231', 'kuaidi100');
示例:
[
"status" => "200",
"message" => "OK",
"error_code" => "3",
"data" => [
["time" => "2018-12-21 17:51:32", "ftime" => "2018-12-21 17:51:32", "context" => "已签收", "location" => NULL],
["time" => "2018-12-21 17:51:32", "ftime" => "2018-12-21 16:51:32", "context" => "派件中", "location" => NULL],
["time" => "2018-12-21 17:51:32", "ftime" => "2018-12-20 13:51:32" ,"context" => "已到达", "location" => NULL]
],
"logistics_company" => "shentong",
"logistics_bill_no" => "12313131231",
]
$logistics->getLogisticsByName('12313131231', 'baidu');
示例:
[
"status" => "0",
"message" => "",
"error_code" => "0",
"data" => [
["time" => "1545444420", "desc" => "已签收"],
["time" => "1545441977", "desc" => "派件中"],
["time" => "1545438199", "desc" => "已到达"]
],
"logistics_company" => "shentong",
"logistics_bill_no" => "12313131231",
]
$logistics->getLogisticsByArray('12313131231'); // 只要一个接口请求成功, 停止请求下一个接口
$logistics->getLogisticsByArray('12313131231', ['baidu', 'kuaidi100']);
示例:
[
"kuaidi100" => [
"info" => [
status" => "200",
"message" => "OK",
"error_code" => "3",
"data" => [
["time" => "2018-12-21 17:51:32", "ftime" => "2018-12-21 17:51:32", "context" => "已签收", "location" => NULL],
["time" => "2018-12-21 17:51:32", "ftime" => "2018-12-21 16:51:32", "context" => "派件中", "location" => NULL],
["time" => "2018-12-21 17:51:32", "ftime" => "2018-12-20 13:51:32" ,"context" => "已到达", "location" => NULL]
],
"logistics_company" => "shentong",
"logistics_bill_no" => "12313131231",
]
]
]
array getLogisticsByName(string $code, $queryName = 'kuaidi100')
array getLogisticsByArray(string $code, $queryArray = ['kuaidi100', 'baidu'])
- $code - 运单号
- $queryName - 接口名称, 目前支持百度(baidu), 快递100(kuaidi100)
- $queryArray - 接口数组, 如: ['kuaidi100', 'baidu']
欢迎提出issue
MIT