PHP code example of dhl / sdk-api-unified-tracking

1. Go to this page and download the library: Download dhl/sdk-api-unified-tracking 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/ */

    

dhl / sdk-api-unified-tracking example snippets



$consumerKey = 'Your application consumer key';
$logger = new \Psr\Log\NullLogger();
$defaultTimeZone = new \DateTimeZone('Europe/Berlin'); // or date_default_timezone_get()
$trackingNumber = '9876543210';

$serviceFactory = new \Dhl\Sdk\UnifiedTracking\Service\ServiceFactory();
$service = $serviceFactory->createTrackingService($consumerKey, $logger, $defaultTimeZone);

$response = $service->retrieveTrackingInformation($trackingNumber);