PHP code example of slince / shipment-tracking-kuaidi100
1. Go to this page and download the library: Download slince/shipment-tracking-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/ */
slince / shipment-tracking-kuaidi100 example snippets
$tracker = new Slince\ShipmentTracking\KuaiDi100\KuaiDi100Tracker(APPKEY, 'shunfeng'); //承运商名称并不是标准的承运商代码,实际承运商代码请到kuaidi100.com查看
try {
$shipment = $tracker->track('CNAQV100168101');
if ($shipment->isDelivered()) {
echo "Delivered";
}
print_r($shipment->getEvents()); //print the shipment events
} catch (Slince\ShipmentTracking\Exception\TrackException $exception) {
exit('Track error: ' . $exception->getMessage());
}