Get public/external IP address?

Using C#, With webclient its a short one. public static void Main(string[] args) { string externalIpString = new WebClient().DownloadString(“http://icanhazip.com”).Replace(“\\r\\n”, “”).Replace(“\\n”, “”).Trim(); var externalIp = IPAddress.Parse(externalIpString); Console.WriteLine(externalIp.ToString()); } Command Line (works on both Linux and Windows) wget -qO- http://bot.whatismyipaddress.com OR curl http://ipinfo.io/ip

Get the client IP address using PHP [duplicate]

The simplest way to get the visitor’s/client’s IP address is using the $_SERVER[‘REMOTE_ADDR’] or $_SERVER[‘REMOTE_HOST’] variables. However, sometimes this does not return the correct IP address of the visitor, so we can use some other server variables to get the IP address. The below both functions are equivalent with the difference only in how and … Read more