dns_get_record( );
Here we will go over a simple pieace of code that can get dns records for you. When you use this code you will be going out onport 53 to try and retrieve teh DNS records on you hosting providers DNS servers. Some hosting providers block this port so if the code does not work you may need to get it open or try a different server. You can test the port by trying to connect to your server via port 53 using telnet from your computer or one of the various online port checkers.An example of the telnet comand from your comand / terminal window is telnet your_server_name 53 you will either get an error message or on success a blank black screen waiting for a comand. Exit out.
the_code
<?php
//Create the variable
$dns_any = dns_get_record ( 'google.com', DNS_ANY );
//Find the number of keys in the array
$count = count( $dns_any );
// Out put the number of keys found and then output the first key
echo $count . '<br/>';
echo $dns_any[0];
?>
5
array(7) { ["host"]=> string(10) "google.com" ["class"]=> string(2) "IN" ["ttl"]=> int(24360) ["type"]=> string(3) "CAA" ["flags"]=> int(0) ["tag"]=> string(5) "issue" ["value"]=> string(8) "pki.goog" }