Last updated on May 20th, 2016 at 03:50 pm

Get DNS Record using PHP

. We are using dns_get_record() and displaying it using foreach statement. This is a simple tutorial which will show you how to get the DNS information / lookup of a website using php.

$result = dns_get_record("", DNS_ANY);
echo "Result = ";
<hr />
foreach($result as $y) // iterate array elements
if(is_array($y)) // check if $y is array
foreach($y as $k) // iterate array elements in $y (multidimensional)
echo $k."<br>"; // output the result


2 thoughts on “Get DNS Record using PHP”
  1. I am getting Segmentation Faults if the domain contains TXT information. Know about this problem?

Leave a Reply

Your email address will not be published. Required fields are marked *