1. Go to this page and download the library: Download ecommerce-utilities/dhl-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/ */
ecommerce-utilities / dhl-api example snippets
use EcommerceUtilities\DHL\Common\DHLApiCredentials;
use EcommerceUtilities\DHL\Common\DHLBusinessPortalCredentials;
use EcommerceUtilities\DHL\DHLServices;
use GuzzleHttp\Client;
use Http\Factory\Guzzle\RequestFactory;
use Http\Message\StreamFactory\GuzzleStreamFactory;
ew DHLServices($businessCred, $cred, new RequestFactory(), new GuzzleStreamFactory(), new Client());
$response = $services->getRetoureService()->getRetourePdf(
'Max', // $name1
'Mustermann', // $name2
null, // $name3
'Musterstr.', // $street
123, // $streetNumber
72770, // $zip
'Reutlingen', // $city
'DE', // $countryId
'123446-B', // $voucherNr
null // $shipmentReference
);
printf("%s\n", $response->getTrackingNumber());
file_put_contents('label.pdf', $response->getLabelData());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.