1. Go to this page and download the library: Download emailverifyio/emailverify 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/ */
use EmailVerify\SDK\EmailVerify;
// Initialize with your API key
EmailVerify::Instance()->initialize('<YOUR_API_KEY>');
// Validate an email address
$result = EmailVerify::Instance()->validate('[email protected]');
echo "Status: " . $result->status . "\n"; // valid, invalid, unknown, etc.
use EmailVerify\SDK\EmailVerify;
use EmailVerify\SDK\EVException;
try {
// Initialize with your API key
EmailVerify::Instance()->initialize('your-api-key');
} catch (EVException $e) {
// Handle any initialization errors
echo "Error: " . $e->getMessage() . "\n";
}
try {
$result = EmailVerify::Instance()->validate('<EMAIL_ADDRESS>');
echo "Email: " . $result->email . "\n";
echo "Status: " . $result->status . "\n";
echo "Sub-Status: " . $result->subStatus . "\n";
// Determine if email is valid
if ($result->status === 'valid') {
echo "The email is valid and deliverable.\n";
} else if ($result->status === 'invalid') {
echo "The email is not deliverable.\n";
} else {
echo "The email validation is inconclusive.\n";
}
} catch (EVException $e) {
echo "Error Message: " . $e->getMessage() . "\n";
echo "Error Code: " . $e->getErrorCode() . "\n";
$context = $e->getErrorContext();
echo "Error Context : " . print_r($context, true) . "\n";
}
try {
$result = EmailVerify::Instance()->findEmail('<NAME>', '<DOMAIN.COM>');
if ($result->status === 'found') { // Status can found or not_found
echo "Email found: " . $result->email . "\n";
// Use the found email for your purposes
} else {
echo "No email found for this name and domain combination.\n";
}
} catch (EVException $e) {
echo "Error Message: " . $e->getMessage() . "\n";
echo "Error Code: " . $e->getErrorCode() . "\n";
$context = $e->getErrorContext();
echo "Error Context : " . print_r($context, true) . "\n";
}
try {
$emails = [
'[email protected]',
'[email protected]',
'[email protected]'
];
$result = EmailVerify::Instance()->validateBatch('<TITLE>', $emails); // Title and emails are ount Duplicate Removed: " . $result->countDuplicateRemoved . "\n";
echo "Count Processing: " . $result->countProcessing . "\n";
echo "Full result object:\n";
print_r($result);
// Store the task ID to check results later
// You can save this to your database or file
$taskId = $result->taskId;
} catch (EVException $e) {
echo "Batch validation error: " . $e->getMessage() . "\n";
}
try {
// Use the task ID from your previous batch submission
$task_id = 2900;
$result = EmailVerify::Instance()->getBatchResults($task_id);
echo "Status: " . $result->status . "\n";
echo "Count Check: " . $result->countChecked . "\n";
echo "Count Total: " . $result->countTotal . "\n";
echo "Name: " . $result->name . "\n";
echo "TaskId: " . $result->taskId . "\n";
echo "Progress: " . $result->progressPercentage . "\n";
// Check if the batch processing is complete
if ($result->status === 'verified') {
echo "Batch processing complete. Results:\n";
// Process each email result
foreach ($result->results->emailBatch as $emailResult) {
echo $emailResult['address'] . ": " . $emailResult['status'];
if (isset($emailResult['sub_status'])) {
echo " (" . $emailResult['sub_status'] . ")";
}
echo "\n";
}
} else {
echo "Batch still processing. Check back later.\n";
}
} catch (EVException $e) {
echo "Batch results retrieval error: " . $e->getMessage() . "\n";
}
use EmailVerify\SDK\EVException;
use EmailVerify\SDK\EVMissingApiKeyException;
use EmailVerify\SDK\EVMissingParameterException;
try {
$result = EmailVerify::Instance()->validate('[email protected]');
// Process result...
} catch (EVMissingApiKeyException $e) {
// Handle missing API key error
echo "Please configure your API key first.\n";
} catch (EVMissingParameterException $e) {
// Handle missing parameter error
echo "Missing
composer install --dev
bash
# Run all tests
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/
# Run a specific test file
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/EmailVerifyTest.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.