PHP - Function DNS Get Record



Syntax

array dns_get_record ( string $hostname [, int $type = DNS_ANY [, array &$authns [, array &$addtl [, bool &$raw = false ]]]] )

Definition and Usage

It fetches the DNS resourse record assosicated with a host name

Return Values

The Return values assosicated with array in true case or else failure on false case.

Syslog variables

Parameters Discription
hostname Host Name Should be valid DNS Host Name such as www.tutorialspoint.com.
type Type is associated with Host name such as DNS_A, DNS_CNAME, DNS_HINFO, DNS_MX, DNS_NS, DNS_PTR, DNS_SOA, DNS_TXT, DNS_AAAA, DNS_SRV, DNS_NAPTR, DNS_A6, DNS_ALL.
addtl it will passed by reference and, if given, will be populated with any Additional Records.
raw If it is in raw mode,query only the requestd type instead of looping type by type before going with the additional info stuff

Example

Try out following example

<?php
$result = dns_get_record("www.tutorialspoint.com");
print_r($result);
?>

Above Example get the records from www.tutorialspoint.com

php_function_reference.htm
Advertisements