You may find it useful in Web programming to know the IP addresses of the visitors to your website. HTML alone does not have the proper functions to find a visitor's IP address, but you may embed a PHP function in your HTML code and use the two together to get IP addresses. Use the "getenv" function, which returns environment variables, such as the "REMOTE_ADDR" element, the IP address of the person viewing the HTML page.
Open the HTML file you in which you want to include a function that finds IP addresses. Insert the cursor where you want to display the visitor's IP address.
Type the following:
$IP = getenv(REMOTE_ADDR);
echo "Your computer's IP address is : $IP";
This PHP tag gets the visitor's address and displays it on your HTML page. You may do other things with the address, such as saving it in a cookie or a database of visitors.
Save the HTML file and upload it to your Web server. The function does not work unless it is on the Internet.
How to Change IP Address in Windows Vista
The term "IP Address" stands for Internet Protocol Address. It is your computer's identification and allows you to connect with and identify...
How to Convert IP Addresses to Binary Code
When you see an IP address in decimal format (for example, 126.96.36.199), you are seeing a decimal representation of the binary code...
How to Track a Website Visitor's IP Address in HTML
Tracking a website visitor's IP address is invaluable in the Internet world. The IP or "Internet Protocol" address is a number that...