PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I find a visitors IP address?


A common requirement is to be able to log or store the IP address of a visitor to your website.

In order to do this, you can easily access the IP address through an environment variable.

The one that you want for the IP Address is called $REMOTE_ADDR, so you can access it like this:

<?php
$ip 
$REMOTE_ADDR;
echo 
"Your IP address is $ip";
?>



More website PHP Questions

How do I perform a 301 redirect with PHP?
How do I keep my site menu in one file?
How do I make sure an include file exists before loading the page?
How to find a domain name for an IP address?
How do I display todays date on my website?