note 9775 added to gethostbyaddr
| From: | bruno at angelsp dot org | Date: | Wed, 22 Nov 2000 23:20:11 +0000 |
| Subject: | note 9775 added to gethostbyaddr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8012@lists.php.net to get a copy of this message | ||
This is a really usefull function.. I ussualy use it to know the name of the country that the host
has.. (.pt, .es, .uk, etc)..
here is a litle idea of what one can do with this..
I get the $ipa with the remote_addr function..
<?
$host = gethostbyaddr($ipa);
$at = $host
$hostdot = ".";
$result = strrchr($at, $hostdot);
echo "The country is $result";
?>
Of course, if a .com or .org or .net domain name (tld) it won't be a country.. but you can work
that out with and if or case statements..
and of course, I can be totally mistaken ;P
http://www.php.net/manual/function.gethostbyaddr.php