Implementation with Composer
install the package:
composer require adresslabor/check-service
how to use the checkClient:
// initialize the checkClient
$apiCid = "0000";
$apiKey = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
$associative = true;
// The client will test your credentials first
$checkClient = new \Adresslabor\CheckService\CheckClient($apiCid, $apiKey, $associative);
// get your available credits
$availableCredits = $checkClient->credits;
// https://adresslabor.de/de/produkte/adress-check-dach.html
$scResult = $checkClient->addressCheckDACH("Kolping Str.", "14", "63768", "Hösbach", "DE");
$scxResult = $checkClient->addressCheckDACH("Kolping Str.", "14", "63768", "Hösbach", "DE", true);
// https://adresslabor.de/de/produkte/adress-check-world.html
$scIntResult = $checkClient->addressCheckWorld("Kolping Str.", "14", "63768", "Hösbach", "DE","","","", "", "", "");
// https://adresslabor.de/de/produkte/fake-check.html
$fkResult = $checkClient->fakeCheck("Donald", "Duck", "Kolping Str.", "14", "63768", "Hösbach", "DE");
// https://adresslabor.de/de/produkte/name-check-b2c.html
$ncResult = $checkClient->nameCheckB2C("Rolf", "Paschold", "Frau", "Dr.");
// https://adresslabor.de/de/produkte/e-mail-check.html
$emResult = $checkClient->emailCheck("prof@adresslabor.de");
$emxResult = $checkClient->emailCheck("prof@adresslabor.de", true);
// https://adresslabor.de/de/produkte/telefonverzeichnis.html
$pbResult = $checkClient->telephoneDirectory("Donald", "Duck", "Kolping Str.", "63768", "Hösbach", "DE", "+4912345789", "Dr.", "14");
$pbtResult = $checkClient->telephoneDirectory("Donald", "Duck", "Kolping Str.", "63768", "Hösbach", "DE", "+4912345789", "Dr.", "14", true);
// https://adresslabor.de/de/produkte/ust-idnr-check.html
$vatidResult = $checkClient->vatNumberCheck("DE304496992");
$vatidxResult = $checkClient->vatNumberCheck("DE304496992", true);
// execute multiple checks in one single request
$multiCheckResult = $checkClient->check(\Adresslabor\CheckClient::PATH_V3, [
'product' => 'fk,nc,scx',
'firstname' => 'Rolf',
'lastname' => 'Paschold',
'street' => 'Kolping Str.',
'hno' => '14',
'zip' => '63768',
'city' => 'Hösbach'
]);
Implementation with CURL
// Url of the service
$url = 'https://api.adresslabor.de/v1/de/check';
$fields = array(
'product' => 'EMX,SC,FK,PB,NC',
'firstname' => 'Max',
'lastname' => 'Mustermann',
'street' => 'Teststr.',
'hno' => '9',
'zip' => '12345',
'city' => 'Entenhausen',
'country' => 'DE',
'phone' => '01234/56789',
'email' => 'test@test-email.de',
'apicid' => 1,
'apikey' => 'ffffffff-ffff-ffff-ffff-ffffffffffff'
);
//Open connection.
$ch = curl_init();
// Set the right curl-options.
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//Execute post and close connection.
$result = curl_exec($ch);
curl_close($ch);
// Decode json-data
$result = json_decode($result);
// Access the complete result.
print_r($result)
// Access the email-check-result.
print_r($result -> em);
// Access the email-resulttext.
print_r($result -> em -> resulttext);