Thursday, September 18, 2014

Getting Anyone IP address with PHP



Note : Only for educational purpose only

Create a text fie and insert any of the below codes and save it with .php extension e.g. get_ipaddress.php

After saving the code in the text file, then simply upload it to your website and watch what happen next 

Print Out Users IP Address:

<?php 
print ($_SERVER['REMOTE_ADDR'], "I'm Watching You!"); 
?>


Print To A File :


<?php 
$ip = $_SERVER['REMOTE_ADDR']; 
$handle = fopen('ipaddresses.txt'', 'a+); 
fwrite($handle, $ip); fwrite($handle, "\n"); 
fclose($handle); 
?>

No comments: