1. Go to this page and download the library: Download nogrod/dhl-retoure-php-sdk 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/ */
nogrod / dhl-retoure-php-sdk example snippets
Configure API key authorization: ApiKey
$config = Dhl\Rest\Retoure\Configuration::getDefaultConfiguration()->setApiKey('dhl-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Dhl\Rest\Retoure\Configuration::getDefaultConfiguration()->setApiKeyPrefix('dhl-api-key', 'Bearer');
// Configure HTTP basic authorization: BasicAuth
$config = Dhl\Rest\Retoure\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$apiInstance = new Dhl\Rest\Retoure\Api\LocationsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$country_code = new \Dhl\Rest\Retoure\Model\Country(); // Country | The ISO3 code of the location
$postal_code = 'postal_code_example'; // string | The postal code code of the location
$receiver_id = 'receiver_id_example'; // string | The receiver id of the location
$billing_number = 'billing_number_example'; // string
$max_result = 56; // int | The result should be containable.
try {
$result = $apiInstance->getLocations($country_code, $postal_code, $receiver_id, $billing_number, $max_result);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling LocationsApi->getLocations: ', $e->getMessage(), PHP_EOL;
}