Forum Moderators: phranque
PHP is the only programming language I really know. So how can one use PHP (and probably some other tools/services) to do the reverse DNS and forward DNS lookups as suggested in the article referenced above?
Moderators, I posted this thread here because I'm guessing the technique involves several technologies, not just PHP. But please feel free to move this if it belongs in the PHP forum...
E.g.
$first_ip=$_SERVER['REMOTE_ADDR'];
$hostname=gethostbyaddr($first_ip);
You reverse the lookup with gethostbyname [php.net]
$second_ip=gethostbyname($hostname);
if ($second_ip = $first_ip) {
// IPs matched
}
Added: there will be a bit of overhead time in doing this (depending on your server) so you would want to minimise how many lookups you do (i.e. only check visitors with Googlebot's UA)
[edited by: Receptional_Andy at 4:40 pm (utc) on Dec. 8, 2006]