I’m quite a novice at PHP.
I would like the IP address that I (myself, only. I modified my hosts file for the HotSpot shield webpage) have been given when using HotSpot shield to show up on my webpage, but unfortunately, it’s echoed as 127.0.0.1. The main objective is that when I connect, the IP address that I’ve been set is echoed on the page. This is what code I’ve used:
<?php $rmt = $_SERVER["REMOTE_ADDR"]; echo "$rmt \n" ?>
The only problem is is that $rmt is 127.0.0.1. Do any of you know how to get it to display the public IP address to be displayed?
$_SERVER['REMOTE_ADDR']is referring to the IP adress from which you connected. If you’re running the server on your local machine and connecting from your local machine, it uses your local ip (127.0.0.1 is always “localhost”).In order to show a different ip you need to run it on another server (a public web hotel server preferably), or connect to your server from another machine.