Simple Parcel Tracker for Local Parcel Courier. Basically it just crawl the courier website or existing API. Need time to time to monitor web/api changes before failure happen.
BTW, Currently available (Successfully Scraped)
- Post Laju
- GDEX
- ABX Express
- DHL Express
- DHL E-Commerce
- SkyNet Express
- CityLink Express
- FedEx Express
- LEL Express
- KTM Distribution Sdn Bhd
- UPS
Tested in PHP 7.1 Only
composer require afiqiqmal/parcel-track
Alternatively, you can specify as a dependency in your project's existing composer.json file
{
"require": {
"afiqiqmal/parcel-tracker": "^1.0"
}
}
After installing, you need to require Composer's autoloader and add your code.
require_once __DIR__ .'/../vendor/autoload.php';
$data = parcel_track()
->postLaju()
->setTrackingNumber("ER157080065MY")
->fetch();
$data = parcel_track()
->gdex()
->setTrackingNumber("4941410530")
->fetch();
$data = parcel_track()
->abxExpress()
->setTrackingNumber("EZP843055940197")
->fetch();
$data = parcel_track()
->dhlExpress()
->setTrackingNumber("5176011131")
->fetch();
$data = parcel_track()
->setTrackingNumber("5176011131")
->checkCourier();
Method | Param | Description |
---|---|---|
postLaju() | Post Laju Courier | |
abxExpress() | Post Laju Courier | |
dhlExpress() | DHL Express Courier | |
dhlCommerce() | DHL E-Commerce Courier | |
gdex() | GD Express Courier | |
skyNet() | SkyNet Express Courier | |
cityLink() | City Link Express Courier | |
fedEx() | FedEx Express Courier | |
lelExpress() | Lazada E-Logistic Courier | |
ktmDelivery() | KTM Distribution Sdn Bhd | |
ups() | United Parcel Service Courier | |
setTrackingNumber($refNumber) | String |
Enter the tracking number |
For checking which carrier response like below:
{
"code": 200,
"error": false,
"possible_carrier": [
"ABX Express Sdn Bhd",
"City Link Express"
],
"generated_at": "2018-05-14 08:53:35",
"footer": {
"developer": {
"name": "Hafiq",
"homepage": "https://github.com/afiqiqmal"
}
}
}
You should getting data tracker similarly like below:
{
"code": 200,
"error": false,
"tracker": {
"tracking_number": "4941410530",
"provider": "gdex",
"delivered": true,
"checkpoints": [
{
"date": "2016-11-30 17:41:10",
"timestamp": 1480527670,
"process": "Outbound from KBR station",
"type": "item_received",
"event": "Kota Bharu"
},
{
"date": "2016-11-30 17:47:00",
"timestamp": 1480528020,
"process": "Picked up by courier",
"type": "dispatch",
"event": "Kota Bharu"
},
{
"date": "2016-12-01 03:25:11",
"timestamp": 1480562711,
"process": "In transit",
"type": "facility_process",
"event": "Petaling Jaya"
},
{
"date": "2016-12-01 10:00:16",
"timestamp": 1480586416,
"process": "Inbound to JHB station",
"type": "facility_process",
"event": "Johor Bharu"
},
{
"date": "2016-12-02 10:10:00",
"timestamp": 1480673400,
"process": "Delivered",
"type": "delivered",
"event": "Sungai Tiram"
}
]
},
"generated_at": "2018-05-03 02:07:20",
"footer": {
"source": "GD Express Sdn Bhd",
"developer": {
"name": "Hafiq",
"homepage": "https://github.com/afiqiqmal"
}
}
}
- Struggling for other Parcel Data
- Keep up to date if any parcel data changes
- If Issue happen like the api always return empty [] after cross check with real site, just let me know =)
Pftt.. I just don't know why, the Travis CI is failed. It because of `gnutls_handshake() failed`. In my local env, all Test Unit Passed . I disabled it first because always failing on travis-ci.org =)
## ChangeLog - See changelog.md
Licensed under the MIT license