PHP code example of wythe / logistics
1. Go to this page and download the library: Download wythe/logistics library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wythe / logistics example snippets
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);
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'
]
]
]
]