Get details about DNS lookup of the domains with php.This simple php script can be used to get details about DNS lookup with MX records,text records,CNAME records,SOA…etc . Final result is getting 2D or 3D array of the DNS lookup details of the given domain.

Final output


Array
(
[0] => Array
(
[host] => webexplorar.com
[type] => MX
[pri] => 1
[target] => ASPMX.L.GOOGLE.com
[class] => IN
[ttl] => 14400
)

[1] => Array
(
[host] => webexplorar.com
[type] => MX
[pri] => 5
[target] => ALT1.ASPMX.L.GOOGLE.com
[class] => IN
[ttl] => 14400
)

[2] => Array
(
[host] => webexplorar.com
[type] => MX
[pri] => 5
[target] => ALT2.ASPMX.L.GOOGLE.com
[class] => IN
[ttl] => 14400
)

[3] => Array
(
[host] => webexplorar.com
[type] => MX
[pri] => 10
[target] => ASPMX2.GOOGLEMAIL.com
[class] => IN
[ttl] => 14400
)

[4] => Array
(
[host] => webexplorar.com
[type] => MX
[pri] => 10
[target] => ASPMX3.GOOGLEMAIL.com
[class] => IN
[ttl] => 14400
)

[5] => Array
(
[host] => webexplorar.com
[type] => TXT
[txt] => v=spf1 +a +mx +ip4:204.152.255.8 ?all
[entries] => Array
(
[0] => v=spf1 +a +mx +ip4:204.152.255.8 ?all
)

[class] => IN
[ttl] => 14400
)

[6] => Array
(
[host] => webexplorar.com
[type] => SOA
[mname] => ns1.hostable.com
[rname] => noc.brinkster.com
[serial] => 2013012101
[refresh] => 86400
[retry] => 7200
[expire] => 3600000
[minimum-ttl] => 86400
[class] => IN
[ttl] => 86400
)

If you want to display DNS lookup details as formatted table, do that as following.

’;

Final output after formatted

webexplorar.com MX 10 ASPMX3.GOOGLEMAIL.com IN 14400
webexplorar.com MX 1 ASPMX.L.GOOGLE.com IN 14400
webexplorar.com MX 5 ALT1.ASPMX.L.GOOGLE.com IN 14400
webexplorar.com MX 5 ALT2.ASPMX.L.GOOGLE.com IN 14400
webexplorar.com MX 10 ASPMX2.GOOGLEMAIL.com IN 14400
webexplorar.com TXT v=spf1 +a +mx +ip4:204.152.255.8 ?all IN 14400
webexplorar.com SOA ns1.hostable.com noc.brinkster.com 2013012101 86400 7200 3600000 86400 IN 86400
webexplorar.com NS ns1.hostable.com IN 86400
webexplorar.com NS ns2.hostable.com IN 86400
webexplorar.com A 204.152.255.8 IN 14400

View Demo