views:

35

answers:

1

Fairly simple question (I think): I have a list of domains, and I want to loop through them, hitting their email and web servers, and determining the type of server software running. Something like this:

LOOP over domain list ... Socket connect with www.[domain-name] over Port 80 ... Get return handshake volley of server type > plug into array ... Close socket ... Socket connect with mail.[domain-name] over Port 25 ... Get return handshake volley of server type > plug into array ... Close socket ... END LOOP

I don't know of a discovery mechanism to derive the primary MX from a base domain name - probably not possible. I seem to remember opening and closing sockets needs some grace time (sleep?).

Any advice or example code would be much appreciated - thanks in advance.

-Dean

A: 

Actually there is a PHP function for just what you described getmxrr ( http://www.php.net/manual/en/function.getmxrr.php )

There are a bunch of examples in the comments of the manual page.

Ambirex
Wow - good stuff. Do you have any canned code for opening/closing socket requests as described above. My PHP/Perl is fairly rusty, and if I can work from an example I can save some serious time. Thanks in advance.
Dean