IT Community Malaysia

Members Login
    Remember Me  
Post Info TOPIC: How to grab IP address with PHP

Smasher Hax

Status: Offline
Posts: 267
How to grab IP address with PHP

Today I’ll be showing you how to grab somebodies IP address when they visit a page.

The variable to use is $_SERVER['REMOTE_ADDR'] - It’s that simple. You can use it
for just about anything, here are a few examples.

Printing the Users IP Address:
print ($_SERVER['REMOTE_ADDR'], "I'm Watching You!");

Printing it to a File:
$handle = fopen('ipaddresses.txt'', 'a+);
fwrite($handle, $ip); fwrite($handle, "\n");

All you have to do, is to make a text file and insert any of these codes or one of your
own and save it as anythingyouwant.php
Then upload it to your website and it'll do the trick :P
The Possibilities for what you can use this to are endless.
Good luck :D


I am Sharper

ITC - Internet Moderators

Mods Name: KA

Page 1 of 1  sorted by
Quick Reply

Please log in to post quick replies.

Tweet this page Post to Digg Post to

Create your own FREE Forum
Report Abuse
Powered by ActiveBoard