Zend - The PHP Company




External

Add Code


external nslookup that displays only the resolved address.  

Type: code fragment
Added by: kurth
Entered: 11/09/2000
Last modified: 01/12/2000
Rating: - (fewer than 3 votes)
Views: 8512
This code displays the remote address of the machine calling the page. Uses nslookup and grep.


<?php
/*
Written By Kurth Bemis (kurth@usaexpress.net)

This snippet uses nslookup and grep to retrieve the fully resolved remote address and display it.

Mail me if you have any problems

~kurth

*/

$runext exec("nslookup $REMOTE_ADDR | grep ame:"$output$error); 

if (!
$error){
    list(,
$run) = each($output);
    
$display substr ("$run"6);
    print 
"Remote Address: $display <BR>";
}
if (
$error){ 
  echo 
"Unix error code: $error<BR>n"
  exit; 


?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories