note 30389 deleted from function.explode by kennyt
| From: | kennyt@php.net | Date: | Sat, 28 Feb 2004 20:28:09 +0000 |
| Subject: | note 30389 deleted from function.explode by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65953@lists.php.net to get a copy of this message | ||
Note Submitter: imagiro
----
for easy reverse dns-lookups i use the following script:
if (!isset($GLOBALS['HTTP_SERVER_VARS']['argv'][1]))
die("usage: {$GLOBALS['HTTP_SERVER_VARS']['argv'][0]}
ip-address\n");
$ip = $GLOBALS['HTTP_SERVER_VARS']['argv'][1];
$ar = explode('.',$ip);
if (sizeof($ar) != 4)
die("error: $ip not a valid ip\n");
$rip = implode('.',array_reverse ($ar));
passthru("nslookup -type=PTR $rip.in-addr.arpa.");
or, the short way:
passthru( "nslookup -type=PTR ".implode('.', array_reverse (
explode('.', $GLOBALS['HTTP_SERVER_VARS']['argv'][1])
)).".in-addr.arpa." );