Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

In web programming, with the server variable REMOTE_ADDR, you can get the IP address of the user. For example in PHP:
PHP
<?php
echo $_SERVER['REMOTE_ADDR'];
?>

The output on the page is the IP address of the user.
But how the server knows the IP address of the user?

Thanks in advance.
Posted

1 solution

Certain information about the user is always passed to the webserver when a connection is established. IP Address is one of them.

unless you are in a LAN, its usually the ip-address of the router that gets displayed when visiting public web sites.


hope that helps.

Cheers
 
Share this answer
 
Comments
Thomas Daniels 31-Dec-12 5:49am    
Thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900