We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<?php use Amp\Dns\DnsConfig; use Amp\Dns\DnsConfigLoader; use Amp\Dns\DnsRecord; use Amp\Dns\HostLoader; use Amp\Dns\Rfc1035StubDnsResolver; use function Amp\Dns\dnsResolver as dnsResolverFactory; require_once __DIR__ . '/vendor/autoload.php'; $dnsServers = ['1.1.1.1:53']; $dnsResolver = dnsResolverFactory( new Rfc1035StubDnsResolver( null, new class ($dnsServers) implements DnsConfigLoader { public function __construct(private readonly array $dnsServers = []) { } public function loadConfig(): DnsConfig { return new DnsConfig($this->dnsServers, (new HostLoader())->loadHosts()); } } ) ); $domain = 'not.existing.domain.com'; try { $dnsResolver->resolve($domain, DnsRecord::A); } catch (Throwable $e) { echo $e->getMessage() . PHP_EOL; } $domain = 'discord.com'; try { $dnsResolver->resolve($domain, DnsRecord::AAAA); } catch (Throwable $e) { echo $e->getMessage() . PHP_EOL; }
$ php test.php Giving up resolution of 'not.existing.domain.com', too many redirects Giving up resolution of 'discord.com', too many redirects
When no records are retrieved from DNS, the redirect mechanism throws an DnsException.
dns/src/Rfc1035StubDnsResolver.php
Line 209 in b7515c1
The text was updated successfully, but these errors were encountered:
Fix #120: Incorrect error message on missing domain
48444d3
00bc06d
f2ed903
No branches or pull requests
When no records are retrieved from DNS, the redirect mechanism throws an DnsException.
dns/src/Rfc1035StubDnsResolver.php
Line 209 in b7515c1
The text was updated successfully, but these errors were encountered: