PHP » GoLang |
login |
register |
about
|
|
dns_get_record(PHP 5, PHP 7) dns_get_record — Fetch DNS Resource Records associated with a hostname Description
array dns_get_record
( string
$hostname
[, int $type = DNS_ANY
[, array &$authns
[, array &$addtl
[, bool $raw = FALSE
]]]] )
Fetch DNS Resource Records associated with the given
Parameters
Return Values
This function returns an array of associative arrays,
or
Changelog
Examples
Example #1 Using dns_get_record()
<?phpThe above example will output something similar to:
Array
(
[0] => Array
(
[host] => php.net
[type] => MX
[pri] => 5
[target] => pair2.php.net
[class] => IN
[ttl] => 6765
)
[1] => Array
(
[host] => php.net
[type] => A
[ip] => 64.246.30.37
[class] => IN
[ttl] => 8125
)
)
Example #2 Using dns_get_record() and DNS_ANY
Since it's very common to want the IP address of a mail server
once the MX record has been resolved, dns_get_record()
also returns an array in
<?phpThe above example will output something similar to:
Result = Array
(
[0] => Array
(
[host] => php.net
[type] => MX
[pri] => 5
[target] => pair2.php.net
[class] => IN
[ttl] => 6765
)
[1] => Array
(
[host] => php.net
[type] => A
[ip] => 64.246.30.37
[class] => IN
[ttl] => 8125
)
)
Auth NS = Array
(
[0] => Array
(
[host] => php.net
[type] => NS
[target] => remote1.easydns.com
[class] => IN
[ttl] => 10722
)
[1] => Array
(
[host] => php.net
[type] => NS
[target] => remote2.easydns.com
[class] => IN
[ttl] => 10722
)
[2] => Array
(
[host] => php.net
[type] => NS
[target] => ns1.easydns.com
[class] => IN
[ttl] => 10722
)
[3] => Array
(
[host] => php.net
[type] => NS
[target] => ns2.easydns.com
[class] => IN
[ttl] => 10722
)
)
Additional = Array
(
[0] => Array
(
[host] => pair2.php.net
[type] => A
[ip] => 216.92.131.5
[class] => IN
[ttl] => 6766
)
[1] => Array
(
[host] => remote1.easydns.com
[type] => A
[ip] => 64.39.29.212
[class] => IN
[ttl] => 100384
)
[2] => Array
(
[host] => remote2.easydns.com
[type] => A
[ip] => 212.100.224.80
[class] => IN
[ttl] => 81241
)
[3] => Array
(
[host] => ns1.easydns.com
[type] => A
[ip] => 216.220.40.243
[class] => IN
[ttl] => 81241
)
[4] => Array
(
[host] => ns2.easydns.com
[type] => A
[ip] => 216.220.40.244
[class] => IN
[ttl] => 81241
)
)
|
more
Most requested
more
Last requests
|