PHP code example of dutycalculator / dutycalculator-php-sdk
1. Go to this page and download the library: Download dutycalculator/dutycalculator-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/ */
dutycalculator / dutycalculator-php-sdk example snippets
$client = new DutyCalculator_Client('YOUR_API_KEY');
/*
* Example of getting available import to countries
*/
$countriesTo = $client->getImportToCountries();
print_r($countriesTo->getAsArray());
try
{
$countriesFrom = $client->sendRequest('supported-countries/from', array('display_alpha2_code' => true));
}
catch (DutyCalculator_Exception $e)
{
error_log($e);
$countriesFrom = null;
}
$client = new DutyCalculator_Client('YOUR_API_KEY');
/*
* Example of getting available import to countries
*/
$countriesTo = $client->getImportToCountries();