1
0
mirror of https://github.com/danog/dns.git synced 2024-11-26 20:14:51 +01:00

Fix example in README (#105)

This commit is contained in:
Saif Eddin Gmati 2021-12-16 16:32:47 +01:00 committed by GitHub
parent 261fef2ec1
commit 9ebfdf3ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,15 +21,16 @@ require __DIR__ . '/examples/_bootstrap.php';
$githubIpv4 = Amp\Dns\resolve("github.com", Dns\Record::A);
pretty_print_records("github.com", $githubIpv4);
$googleIpv4 = Amp\Dns\resolve("google.com", Dns\Record::A);
$googleIpv6 = Amp\Dns\resolve("google.com", Dns\Record::AAAA);
$firstGoogleResult = Amp\Future\race([
Amp\async(fn() => Amp\Dns\resolve("google.com", Dns\Record::A)),
Amp\async(fn() => Amp\Dns\resolve("google.com", Dns\Record::AAAA)),
]);
$firstGoogleResult = Amp\Promise\first([$googleIpv4, $googleIpv6]);
pretty_print_records("google.com", $firstGoogleResult);
$combinedGoogleResult = Amp\Dns\resolve("google.com");
pretty_print_records("google.com", $combinedGoogleResult);
$googleMx = yield Amp\Dns\query("google.com", Amp\Dns\Record::MX);
$googleMx = Amp\Dns\query("google.com", Amp\Dns\Record::MX);
pretty_print_records("google.com", $googleMx);
```