PHP has in built facility to detect remote browser or IP address and other properties. These values are assigned to special variable. In this case, it is assigned to variable called REMOTE_ADDR. You can use any one of the following statement to obtained or read IP address:
$ip = $_SERVER['REMOTE_ADDR'];
OR
$ip= $REMOTE_ADDR;
Here is sample code:
Or you can try this one also---
$ip = $_SERVER['REMOTE_ADDR'];
OR
$ip= $REMOTE_ADDR;
Here is sample code:
<?
$ip= $REMOTE_ADDR;
echo "<br> Your IP address : " . $ip;
echo "<br> Your hostname : " . GetHostByName($ip);
?>
$ip= $REMOTE_ADDR;
echo "<br> Your IP address : " . $ip;
echo "<br> Your hostname : " . GetHostByName($ip);
?>
Or you can try this one also---
To get the user’s IP use the following script:
To get the user’s computer name use the following script:
<?php GetHostByName($REMOTE_ADDR); ?>
<?php gethostbyaddr($_SERVER['REMOTE_ADDR']); ?>
No comments:
Post a Comment