What is my IP Address

My IPV6 Address

44.192.38.49

My IPV4 Address

,&1

Get online IP address. What is my IP provide both IPV4 and IPV6 Address. There are lot of ways to get the client IP address using PHP, Java, Asp.net

Get IP address using PHP
	function client_ip() {
		$ipaddress = '';
		if (isset($_SERVER['HTTP_CLIENT_IP']))
			$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
		else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
			$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
		else if(isset($_SERVER['HTTP_X_FORWARDED']))
			$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
		else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
			$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
		else if(isset($_SERVER['HTTP_FORWARDED']))
			$ipaddress = $_SERVER['HTTP_FORWARDED'];
		else if(isset($_SERVER['REMOTE_ADDR']))
			$ipaddress = $_SERVER['REMOTE_ADDR'];
		else
			$ipaddress = 'UNKNOWN';
		return $ipaddress;
	}
							
Get IP address using Asp.net
	public string client_ip()
	{
		System.Web.HttpContext context = System.Web.HttpContext.Current; 
		string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
		if (!string.IsNullOrEmpty(ipAddress))
		{
			string[] addresses = ipAddress.Split(',');
			if (addresses.Length != 0)
			{
				return addresses[0];
			}
		}
		return context.Request.ServerVariables["REMOTE_ADDR"];
	}

	
Get IP address using Java
	import java.net.DatagramSocket;
	import java.net.InetAddress;

	try(final DatagramSocket socket = new DatagramSocket()){
	  socket.connect(InetAddress.getByName("8.8.8.8"), 10002);
	  ip = socket.getLocalAddress().getHostAddress();
	}

another example

import java.net.InetAddress; import java.net.UnknownHostException; public class client_ip { public static void main(String[] args) { InetAddress ip; String hostname; try { ip = InetAddress.getLocalHost(); hostname = ip.getHostName(); System.out.println("Your current IP address : " + ip); System.out.println("Your current Hostname : " + hostname); } catch (UnknownHostException e) { e.printStackTrace(); } } }
Get IP address using JavaScript

We can not get the client IP address using JavaScript. We can build an API and get the IP address using server side languages like PHP/Java.