Wallogit.com
2017 © Pedro Peláez
This library provides a convient interface for email verification with emaillistverify in PHP., (*1)
Install via composer: composer require korra88/email-list-verify-api-php-client.
Or download in your project and include the two files in src/ directory., (*2)
First obtain an api key by registering in emailistverify, creating an application, and set it in the constructor., (*3)
// composer autoloader require_once '/path/to/vendor/autoload.php'; $emailVerify = new EmailListVerify\APIClient(YOUR_API_KEY);
Then you can either can verify emails one by one with:, (*4)
$email = "your_email@example.com";
try {
$status = $emailVerify->verifyEmail($email);
} catch (Exception $e) {
echo "\n" . $e->getMessage();
$status = false;
}
echo "\n{$email} status: " . ($status ? 'valid' : 'invalid')
Or upload a file with a list of emails in a csv-like format:, (*5)
$email_file_path = __DIR__ . '/email_list.csv';
$email_file_name = 'test_emails.csv';
try {
$file_id = $emailVerify->verifyApiFile($email_file_name, $email_file_path);
} catch (Exception $e) {
echo "\n" . $e->getMessage();
}
echo "\nCreated file {$file_id}.";
and monitor it's status with:, (*6)
try {
$file_info = $emailVerify->getApiFileInfo($file_id);
echo "\nFile status: {$file_info->status}";
} catch (Exception $e) {
echo "\n" . $e->getMessage();
}
When status is finished you can download the file (using $file_info->link2) and read results., (*7)
More information can be found in official documentation here., (*8)