How to write a script to find out IP addresses

Maybe you want to let all your website visitors to see their IP address, or maybe you want to track visitors to your site. Maybe you have a dynamic IP and want an easy way to figure it out. Well, here’s a super easy script to figure it out. All you need is a webserver and PHP installed.

The command that does all the work is this: $_SERVER[“REMOTE_ADDR”]. If all you want to do is display the IP add this in your line of code:


To make it all pretty, here’s what I did:

<h2><u>Your IP Address:</u></h2>
<table cellspacing=10 cellpadding=20 border=1><tr><td>
<b><?php echo $_SERVER["REMOTE_ADDR"] ?></b>

To see a working model or use for future reference, go here.

Reference: You can find more information about the $_SERVER variable from the PHP website.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

2 Comments so far »

  1. Brina said

    am October 28 2008 @ 5:30 pm

    Great work.

  2. bruppybiabs said

    am March 6 2009 @ 11:53 am

    Very good site! Thanks! faithbase

Comment RSS · TrackBack URI

Leave a comment

Name: (Required)

eMail: (Required)



Comments links could be nofollow free.