-
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy path12-all-types.php
More file actions
29 lines (21 loc) · 724 Bytes
/
12-all-types.php
File metadata and controls
29 lines (21 loc) · 724 Bytes
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
<?php
// $ php examples/12-all-types.php
// $ php examples/12-all-types.php myserverplace.de SSHFP
use React\Dns\Config\Config;
use React\Dns\Resolver\Factory;
require __DIR__ . '/../vendor/autoload.php';
$config = Config::loadSystemConfigBlocking();
if (!$config->nameservers) {
$config->nameservers[] = '8.8.8.8';
}
$factory = new Factory();
$resolver = $factory->create($config);
$name = $argv[1] ?? 'google.com';
assert(is_string($name));
$type = constant('React\Dns\Model\Message::TYPE_' . ($type ?? 'TXT'));
assert(is_int($type));
$resolver->resolveAll($name, $type)->then(static function (array $values): void {
var_dump($values);
}, function (Throwable $e) {
echo $e->getMessage() . PHP_EOL;
});