PHP code example of puzzle9 / kuaidi100

1. Go to this page and download the library: Download puzzle9/kuaidi100 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/ */

    

puzzle9 / kuaidi100 example snippets


use Puzzle9\Kuaidi100\Express;

$express = new Express($key, $customer);

//实时查询
$info = $express->synquery($com, $num, $phone=null); // 快递服务商 快递单号 手机号

//智能判断快递服务商
$info = $express->autonumber($num); // 快递单号

//订阅推送
$info = $express->subscribe($company, $number); // 快递服务商 快递单号

//从公司编码获取公司名称
$info = $express->kdbm($code, $getName=true, $default); // 快递编码 是否获取公司名称 未获取到默认返回

     .
     .
     .
    'kuaidi100' => [
        'key' => env('KUAIDI100_KEY'),
        'customer' => env('KUAIDI100_CUSTOMER'),
        'callbackurl' => env('KUAIDI100_CALLBACKURL'),
    ],
 


    use Puzzle9\Kuaidi100\Express;
     .
     .
     .
     public function query(Express $express) 
     {
        $info = $express->synquery($com, $num, $phone=null);
     }
     .
     .
     .
 

     .
     .
     .
     public function query() 
     {
         $response = app('Kuaidi100')->synquery($com, $num, $phone=null);
     }
     .
     .
     .