PHP code example of whois-api / email-verifier
1. Go to this page and download the library: Download whois-api/email-verifier 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/ */
whois-api / email-verifier example snippets
WhoisApi\EmailVerifier\Builders\ClientBuilder;
$builder = new ClientBuilder();
$client = $builder->build('Your API key');
try {
echo $client->getRawData('[email protected]', 'json') . PHP_EOL;
/* Disable refreshing */
echo print_r($client->get('[email protected]', ['_hardRefresh']), true) . PHP_EOL;
$result = $client->get('[email protected]', ['_hardRefresh']);
echo 'Email: ' . $result->emailAddress . PHP_EOL;
echo 'Format: ' . ($result->formatCheck ? 'valid' : 'invalid') . PHP_EOL;
echo 'DNS: '. ($result->dnsCheck ? 'resolved' : 'not resolved') . PHP_EOL;
echo 'SMTP: ' . ($result->smtpCheck ? 'working' : 'not working') . PHP_EOL;
echo 'Free: ' . ($result->freeCheck ? 'yes' : 'no') . PHP_EOL;
echo 'Catch all: ' . ($result->catchAllCheck ? 'yes' : 'no') . PHP_EOL;
echo 'Disposable: ' . ($result->disposableCheck ? 'yes' : 'no') . PHP_EOL;
} catch (\Throwable $exception) {
echo "Error: {$exception->getCode()} {$exception->getMessage()}" . PHP_EOL;
}
bash
export API_KEY="<Your-API-key>"
php examples/basic.php