Stars: 303
Forks: 31
Pull Requests: 15
Issues: 11
Watchers: 11
Last Updated: 2023-03-17 13:23:27
PHP 多接口获取快递物流信息包
License:
Languages: PHP
简单便捷查询运单快递信息
平台 | 次数 | 是否需要快递公司编码 | 免费版支持的快递公司 |
---|---|---|---|
快递100 | 100次(首次申请) | Y | |
快递鸟 | 500单/天(免费) | Y | 支持申通、圆通、百世、天天,其他快递公司可自行尝试,不支持顺丰 |
聚合数据 | 100次(首次申请) | Y | |
极速数据 | 1000次(免费) | N | |
数据智汇 | 100次(免费) | N |
$ composer require wythe/logistics -vvv
use Wythe\Logistics\Logistics;
$config = [
'juhe' => ['app_key' => 'app_key', 'vip' => false],
'shujuzhihui' => ['app_key' => 'app_key', 'vip' => false],
'jisu' => ['app_key' => 'app_key', 'vip' => false],
'kuaidibird' => ['app_key' => 'app_key', 'app_secret' => 'app_secret', 'vip' =>
false],
'kuaidi100' => ['app_key' => '']
];
$logistics = new Logistics($config);
array query(string $code, $channels = ['kuaidi100'], string $company = '')
array queryByProxy(array $proxy, string $code, $channels = ['kuaidi100'], string $company = '')
use Wythe\Logistics\Logistics;
$config = [
'juhe' => ['app_key' => 'app_key', 'vip' => false],
'shujuzhihui' => ['app_key' => 'app_key', 'vip' => false],
'jisu' => ['app_key' => 'app_key', 'vip' => false],
'kuaidibird' => ['app_key' => 'app_key', 'app_secret' => 'app_secret', 'vip' =>
false],
'kuaidi100' => ['app_key' => '']
];
$logistics = new Logistics($config);
$logistics->query('12313131231', ''); // 第二参数选填,可以为字符串或数组, 默认快递鸟
$logistics->query('12313131231', 'kuaidi100');
$logistics->query('12313131231', ['kuaidi100']);
示例:
[
'kuaidi100' => [
'channel' => 'kuaidi100',
'status' => 'success',
'result' => [
[
'status' => 200,
'message' => 'OK',
'error_code' => 0,
'data' => [
['time' => '2019-01-09 12:11', 'description' => '仓库-已签收'],
['time' => '2019-01-07 12:11', 'description' => '广东XX服务点'],
['time' => '2019-01-06 12:11', 'description' => '广东XX转运中心']
],
'logistics_company' => '申通快递',
'logistics_bill_no' => '12312211'
],
[
'status' => 201,
'message' => '快递公司参数异常:单号不存在或者已经过期',
'error_code' => 0,
'data' => '',
'logistics_company' => '',
'logistics_bill_no' => ''
]
]
]
]
use Wythe\Logistics\Logistics;
$config = [
'juhe' => ['app_key' => 'app_key', 'vip' => false],
'shujuzhihui' => ['app_key' => 'app_key', 'vip' => false],
'jisu' => ['app_key' => 'app_key', 'vip' => false],
'kuaidibird' => ['app_key' => 'app_key', 'app_secret' => 'app_secret', 'vip' =>
false],
'kuaidi100' => ['app_key' => '']
];
$logistics = new Logistics($config);
$logistics->query('12313131231');
$logistics->query('12313131231', ['kuaidi100', 'ickd']);
示例:
[
'kuaidi100' => [
'channel' => 'kuaidi100',
'status' => 'success',
'result' => [
[
'status' => 200,
'message' => 'OK',
'error_code' => 0,
'data' => [
['time' => '2019-01-09 12:11', 'description' => '仓库-已签收'],
['time' => '2019-01-07 12:11', 'description' => '广东XX服务点'],
['time' => '2019-01-06 12:11', 'description' => '广东XX转运中心']
],
'logistics_company' => '申通快递',
'logistics_bill_no' => '12312211'
],
[
'status' => 201,
'message' => '快递公司参数异常:单号不存在或者已经过期',
'error_code' => 0,
'data' => '',
'logistics_company' => '',
'logistics_bill_no' => ''
]
]
],
'ickd' => [
'channel' => 'ickd',
'status' => 'success',
'result' => [
[
'status' => 200,
'message' => 'OK',
'error_code' => 0,
'data' => [
['time' => '2019-01-09 12:11', 'description' => '仓库-已签收'],
['time' => '2019-01-07 12:11', 'description' => '广东XX服务点'],
['time' => '2019-01-06 12:11', 'description' => '广东XX转运中心']
],
'logistics_company' => '申通快递',
'logistics_bill_no' => '12312211'
]
]
]
]
欢迎提出 issue 和 pull request
MIT