PHP code example of kittinan / thailandpost-track

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

    

kittinan / thailandpost-track example snippets


//Do not forget to define Google Chrome or Chromium binary path

$chrome_bin = '/usr/bin/chromium-browser';
$track = new \KS\THAILANDPOST\Track($chrome_bin);
$ems = 'EN123456789TH';
$trackers = $track->getTracks($ems);

//Result return false or array of track status
Array
(
    [0] => Array
        (
            [date] => April 17, 2015  10:42:25
            [location] => PAK CHONG
            [description] => Accept
            [status] => 
        )

    [1] => Array
        (
            [date] => April 17, 2015  13:42:39
            [location] => PAK CHONG
            [description] => Items Into Container
            [status] => 
        )
)


//Do not forget to define Google Chrome or Chromium binary path

$chrome_bin = '/usr/bin/chromium-browser';
$track = new \KS\THAILANDPOST\Track($chrome_bin);

//For Thai language (default)
$track->enableThaiLanguage

//For English language
$track->enableEngLanguage();

$ems = 'EN123456789TH';
$trackers = $track->getTracks($ems);