note 34524 added to function.gethostbyaddr
| From: | Matt at rack1 dot php dot net | Date: | Tue, 29 Jul 2003 23:33:36 +0000 |
| Subject: | note 34524 added to function.gethostbyaddr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52973@lists.php.net to get a copy of this message | ||
Well, here's my function I never bothered to make, referenced by the note below.
<?
function getisp ($ip) {
if ($ip==NULL) {
$ip = $_SERVER['REMOTE_ADDR'];
}
$longisp = gethostbyaddr($ip);
$isp = explode(".", $longisp);
$isp = array_reverse($isp);
$ISP = $isp[1].".".$isp[0];
return $ISP;
}
?>
At first I didn't think explode was working with my previous thing, but that was because I was
using arsort() instead of array_reverse().
All is good now. ^.^
----
Manual Page -- http://www.php.net/manual/en/function.gethostbyaddr.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34524
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34524&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34524&report=yes