Documentation

DnsResolver
in

Table of Contents

Methods

query()  : array<int, DnsRecord>
Query specific DNS records.
resolve()  : array<int, DnsRecord>
Resolves a hostname name to an IP address [hostname as defined by RFC 3986].

Methods

query()

Query specific DNS records.

public query(string $name, int $type[, Cancellation|null $cancellation = null ]) : array<int, DnsRecord>

Upon success this method returns an array of Record objects. If no records of the given type are found, a DnsException is thrown.

Parameters
$name : string

Record to question, A, AAAA and PTR queries are automatically normalized.

$type : int

Use constants of Amp\Dns\Record.

$cancellation : Cancellation|null = null
Tags
throws
DnsException
Return values
array<int, DnsRecord>

resolve()

Resolves a hostname name to an IP address [hostname as defined by RFC 3986].

public resolve(string $name[, int|null $typeRestriction = null ][, Cancellation|null $cancellation = null ]) : array<int, DnsRecord>

Upon success this method returns an array of Record objects. If the domain cannot be resolved, a DnsException is thrown.

A null $ttl value indicates the DNS name was resolved from the cache or the local hosts file.

Parameters
$name : string

The hostname to resolve.

$typeRestriction : int|null = null

Optional type restriction to Record::A or Record::AAAA, otherwise null.

$cancellation : Cancellation|null = null
Tags
throws
MissingDnsRecordException
throws
DnsException
Return values
array<int, DnsRecord>

        
On this page

Search results