-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRunTests.php
36 lines (27 loc) · 864 Bytes
/
RunTests.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
spl_autoload_register(function ($className) {
$classFile = __DIR__ . '/' . str_replace('\\', '/', $className) . '.php';
print("Autoloader will attempt to load class \"$className\" from \"$classFile\".\n");
if (file_exists($classFile)) {
require $classFile;
}
});
use Psr\Log\Logger;
require("validateEmailDomainWithDoH.php");
$log = new Psr\Log\Logger();
try {
if (isset($argv[1])) {
$email = $argv[1];
if (validateEmailDomainWithDoH($argv[1], $log)) {
echo "The email domain is valid.\n";
} else {
echo "Invalid email domain.\n";
}
} else {
echo "Usage: {$argv[0]} <email>\n";
}
} catch (Exception $e) {
$log->error("Exception: {$e->getMessage()}");
}
// Use the following command to run this script:
// `php RunTests.php [email protected]`