1. Go to this page and download the library: Download blockpoint/vat24api-php 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/ */
blockpoint / vat24api-php example snippets
// Create a new Vat24Api instance with your API key
$vat24api = new Blockpoint\Vat24Api\Vat24Api('your-api-key');
// Validate a VAT number
try {
$response = $vat24api->validateVat('NL', '836176320B01');
if ($response->hasError()) {
echo "API Error: " . $response->getErrorMessage() . "\n";
echo "Status Code: " . $response->getStatusCode() . "\n";
} elseif ($response->isValid()) {
echo "VAT number is valid!\n";
echo "Company name: " . $response->getCompanyName() . "\n";
echo "Company address: " . $response->getCompanyAddress() . "\n";
} else {
echo "VAT number is not valid!\n";
echo "Reason: " . $response->getFaultString() . "\n";
}
} catch (\Blockpoint\Vat24Api\Exceptions\Vat24ApiException $e) {
echo "Error: " . $e->getMessage() . "\n";
}
// Validate an EORI number
try {
$response = $vat24api->validateEori('GB', '123456789000');
if ($response->hasError()) {
echo "API Error: " . $response->getErrorMessage() . "\n";
echo "Status Code: " . $response->getStatusCode() . "\n";
} elseif ($response->isValid()) {
echo "EORI number is valid!\n";
echo "Company name: " . $response->getCompanyName() . "\n";
} else {
echo "EORI number is not valid!\n";
echo "Reason: " . $response->getFaultString() . "\n";
}
} catch (\Blockpoint\Vat24Api\Exceptions\Vat24ApiException $e) {
echo "Error: " . $e->getMessage() . "\n";
}