Jump to content

[SOLVED] MX /DNS record lookup script


Appzmaster

Recommended Posts

Ive been working on a bunch of different scripts hopefully to make my own dnsstuff.com like tools site I used this same idea for my back end to a script that moves files from my production server to a off site FTP server i have as backups and it worked fine my other script connects to a ftp server lists the contents then disconnects was all fine and dandy but the output looked like crap all smushed together in multiple arrays so i did

 

$contents = ftp_nlist($conn_id, "$dir");

foreach($contents as $a) {
         echo "$a <br />";

 

That works great it neatened it all up and i used the <br> to list all the files directories etc on a different line

 

For my MX /DNS lookup script its the same idea

 

-Original Code to get the ugly multiple arrays

$result = dns_get_record("$host", DNS_ALL);
print_r($result);

 

My idea to list them all on separate lines

$result = dns_get_record("$host", DNS_ALL);
//print_r($result);


      foreach($result as $a) {
      }
foreach($a as $b) {
         echo "$b <br />";
      }

 

It just prints a bunch of lines saying Array the line Array is how i want it to be formated but it doesn't show the information

 

If any one could help point me in the right direction id really appreciate it =) if you need to see my whole code just let me know ill post it.

Link to comment
https://forums.phpfreaks.com/topic/73806-solved-mx-dns-record-lookup-script/
Share on other sites

I came up with a new attempt

 

$result = dns_get_record("$host", DNS_ALL);
//print_r($result);

print_r("<hr>");
for($result_list=0; $result_list < count($result); $result_list++){
$current_line = $result[$result_list];
print "Host: $current_line[host], IP: $current_line[ip], Class: $current_line[class], TTL: $current_line[ttl] And so on...<br>\n";
}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.