PHP code example of twodogeggs / kuaidi100

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

    

twodogeggs / kuaidi100 example snippets


use Twodogeggs\Kuaidi100\Tracker;

try {
    $kuaidi = new Tracker([
        'key' => '你的key',
        'customer' => '你的customer'
    ]);
    $kuaidi->track('快递公司编码', '快递单号');
} catch (Exception $e) {
    
}

use Twodogeggs\Kuaidi100\Tracker;

try {
    $kuaidi = new Tracker([
        'key' => '你的key'
    ]);

    $kuaidi->getAutoTrack('快递单号');
} catch (Exception $e) {
    
}


use Twodogeggs\Kuaidi100\Poll;

try {
    $kuaidi = new Poll([
        'key' => 'uexWYZbd2758',
    ]);

    $kuaidi->getPoll('快递公司编码', '快递单号', '回调地址', '返回格式');
    $kuaidi->getPollByParam([
        // 根据文档的param参数
    ], 'json');
} catch (Exception $e) {
    
}

use Twodogeggs\Kuaidi100\CloudPrint;

try {
    $kuaidi = new CloudPrint([
        'customer' => '快递公司编码',
        'key' => '申请的key',
        'secret' => '分配的secret'
    ]);
} catch (Exception $e) {

}



$kuaidi->getSign();