Use PHP to track Sagawa shipments with Sagawa Tracking API.
- Real-time Sagawa tracking.
- Batch Sagawa tracking.
- Other features to manage your Sagawa tracking.
Installation is easy:
$ composer require trackingmore/trackingmore-sdk-php
Get the API key:
To use this API, you need to generate your API key.
- Click here to access TrackingMore admin.
-
Go to the "Developer" section.
-
Click "Generate API Key".
-
Give a name to your API key, and click "Save" .
Then, start to track your Sagawa shipments.
Create a tracking (Real-time tracking):
require('vendor/autoload.php');
use Trackingmore\TrackingMoreException;
use TrackingMore\Trackings;
$key = 'your api key';
$response = null;
$trackings = new Trackings($key);
try {
$params = ['tracking_number'=>'0301006785462006320995','courier_code'=>'sagawa'];
$response = $trackings->createTracking($params);
} catch (TrackingMoreException $e) {
echo $e->getMessage();
}
print_r($response);
Create trackings (Max. 40 tracking numbers create in one call):
require('vendor/autoload.php');
use Trackingmore\TrackingMoreException;
use TrackingMore\Trackings;
$key = 'your api key';
$response = null;
$trackings = new Trackings($key);
try {
$params = [
['tracking_number'=>'LK201223662AU','courier_code'=>'sagawa'],
['tracking_number'=>'LH290032509AU','courier_code'=>'sagawa']
];
$response = $trackings->batchCreateTrackings($params);
} catch (TrackingMoreException $e) {
echo $e->getMessage();
}
print_r($response);
Get status of the shipment:
require('vendor/autoload.php');
use Trackingmore\TrackingMoreException;
use TrackingMore\Trackings;
$key = 'your api key';
$response = null;
$trackings = new Trackings($key);
try {
# Perform queries based on various conditions
# $params = ['created_date_min'=>'2023-08-23T06:00:00+00:00','created_date_max'=>'2023-09-05T07:20:42+00:00'];
$params = ['courier_code'=>'sagawa','created_date_min'=>'2023-08-23T06:00:00+00:00','created_date_max'=>'2023-09-05T07:20:42+00:00'];
$response = $trackings->getTrackingResults($params);
} catch (TrackingMoreException $e) {
echo $e->getMessage();
}
print_r($response);
Update a tracking by ID:
require('vendor/autoload.php');
use Trackingmore\TrackingMoreException;
use TrackingMore\Trackings;
$key = 'your api key';
$response = null;
$trackings = new Trackings($key);
try {
$params = ['customer_name'=>'New name','note'=>'New tests order note'];
$idString = '9a1339cb81ec08b52985867d176a0ba4';
$response = $trackings->updateTrackingByID($idString,$params);
} catch (TrackingMoreException $e) {
echo $e->getMessage();
}
print_r($response);