Reverse DNS testing

From: Date: Thu, 12 Jul 2012 18:17:22 +0000
Subject: Reverse DNS testing
Groups: php.general 
Request: Send a blank email to php-general+get-318445@lists.php.net to get a copy of this message
I want to do a rDNS check on a admin entered host name to insure in-coming mail servers don't reject mail, sent by my app, because the rDNS doesn't exist or doesn't match. Here is the fundamental code: $host = $_SERVER['SERVER_NAME']; //site name shared or not $ip = gethostbyname($host); $hostName = gethostbyaddr($ip); //May be different on a shared host $ip2 = gethostbyname($hostName); The $ip works fine. However, one of the shared hosts I'm working with returns this instead of the original $host gethostbyaddr($ip)=> 93.247.128.148-static.foo.com [foo is subs for actual] gethostbyname($hostName)=> 93.247.128.148-static.foo.com It appears gethostbyname() is just returning $hostName because it is not legit. Using just the foo.com in gethostbyname() returns the host's server IP. Thus, the typical rDNS check fails for this site. Several online checks also report rDNS fails. Any suggestions how I can handle this?

« previous php.general (#318445) next »