PHP code example of postoor / hct-logistics

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

    

postoor / hct-logistics example snippets


use postoor\HCTLogistics\EDIWebService;

$edi = new EDIWebService('company', 'password');

$shippingData = [
    [
        'epino' => 'O0000001',
        'ercsig' => '苗栗客家圓樓',
        'ertel1' => '037732940',
        'eraddr' => '苗栗縣後龍鎮校椅里7鄰新港三路295號',
        'ejamt' => '1',
        'eqamt' => '71',
    ],
    [
        'epino' => 'O0000002',
        'ercsig' => '彰化扇形車庫',
        'ertel1' => '047624438',
        'eraddr' => '彰化縣彰化市彰美路一段1號',
        'ejamt' => '1',
        'eqamt' => '64',
    ],
];
$data = $edi->uploadTransData($shippingData, $errorMessages);

use postoor\HCTLogistics\EDIWebService;

$edi = new EDIWebService('company', 'password');

$shippingData = [
    [
        'epino' => 'O0000001',
        'edelno' => '1001076020',
        'eqamt' => '71',
    ],
    [
        'epino' => 'O0000002',
        'edelno' => '1001076031',
        'eqamt' => '64',
    ],
];
$data = $edi->updateData($shippingData, $errorMessages);

use postoor\HCTLogistics\EDIWebService;

$edi = new EDIWebService('company', 'password');

$shippingData = [
    [
        'epino' => 'O0000001',
        'edelno' => '1001076020'
    ],
    [
        'epino' => 'O0000002',
        'edelno' => '1001076031'
    ],
];
$data = $edi->transReport($shippingData, $errorMessages);

use postoor\HCTLogistics\Goods;
use postoor\HCTLogistics\GoodsHelper;

$iv = 'LIUALIED';
$v = '6542DFAKLJ4465465465446';
$goods = new Goods($iv, $v);

// Get Tracking History
$data = $goods->queryGoods(['6679804342']);

// Get Tracking Status Code
$goodsHelper = new GoodsHelper();
foreach ($data as $id => $value) {
        $trackData[$id] = $goodsHelper->getGoodsStatusCode($value['detail'][0]['statusString'], 1);
    }