1. Computing & Technology

Discuss in my forum

How to find a user's IP address using PHP

By , About.com Guide

See More About:
You can get a user's IP address using PHP code. You can then use the address to locate where the user is visiting from for targeted advertising, record their location for security purposes, or even report this information back to the user.

The code below will get the IP information for a visitor to your site:

<?php
$ip = getenv("REMOTE_ADDR") ;
Echo "Your IP is " . $ip;
?>

©2012 About.com. All rights reserved.

A part of The New York Times Company.