PHP code example of nomisoft / royal-mail-tracking-api
1. Go to this page and download the library: Download nomisoft/royal-mail-tracking-api 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/ */
nomisoft / royal-mail-tracking-api example snippets
Array
(
[datetime] => DateTime Object
(
[date] => 2016-06-01 12:30:00
[timezone_type] => 3
[timezone] => Europe/London
)
[status] => Delivered
[summary] => Item XX12345678XX was collected and signed for by the addressee on the 2016-06-01 from Kidderminster DO.
)
use \Nomisoft\RoyalMailTrackingApi\RoyalMail;
$rm = RoyalMail::init('CLIENT_ID', 'CLIENT_SECRET', 'APP_ID');
$response = $rm->getSingleItemHistory('XX12345678XX');
use \Nomisoft\RoyalMailTrackingApi\RoyalMail;
$rm = RoyalMail::init('CLIENT_ID', 'CLIENT_SECRET', 'APP_ID');
$response = $rm->getMultiItemSummary(array('XX12345678XX','ZZ12345678ZZ'));
Array
(
[XX12345678XX] => Array
(
[datetime] => DateTime Object
(
[date] => 2016-06-01 12:30:00
[timezone_type] => 3
[timezone] => Europe/London
)
[status] => Delivered
[summary] => Item XX12345678XX was collected and signed for by the addressee on the 2016-06-01 from Kidderminster DO.
)
[ZZ12345678ZZ] => Array
(
[datetime] => DateTime Object
(
[date] => 2016-06-01 12:30:00
[timezone_type] => 3
[timezone] => Europe/London
)
[status] => Delivered
[summary] => We have a record of item ZZ12345678ZZ as being delivered from Fort William DO on 2016-06-01.
)
)
use \Nomisoft\RoyalMailTrackingApi\RoyalMail;
$rm = RoyalMail::init('CLIENT_ID', 'CLIENT_SECRET', 'APP_ID');
$response = $rm->getProofOfDelivery('XX12345678XX');