Online Network Tools www.ipdistance.com


Your IP Address: 54.198.165.74

What's my IP Address?


Your IP address is 54.198.165.74

Hostname:ec2-54-198-165-74.compute-1.amazonaws.com
Flag:
Browser:CCBot/2.0 (http://commoncrawl.org/faq/)

Your Location (Estimated location - maybe wrong)


How to Get IP Address?

PHP:
        function GetIPAddress ()
        {
            if (!empty($_SERVER['HTTP_CLIENT_IP']))  
            {
              $ip = $_SERVER['HTTP_CLIENT_IP'];
            }
            else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))  
            {
              $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
            }
            else
            {
              $ip = $_SERVER['REMOTE_ADDR'];
            }
            return $ip;
        }
    

ASP.NET
        Public Shared Function GetIPAddress() As String
            Dim context As System.Web.HttpContext = 
                System.Web.HttpContext.Current

            Dim sIPAddress As String =
                context.Request.ServerVariables("HTTP_X_FORWARDED_FOR")

            If String.IsNullOrEmpty(sIPAddress) Then
                Return context.Request.ServerVariables("REMOTE_ADDR")
            Else
                Dim ipArray As String() = sIPAddress.Split(
                New [Char]() {","c})
                Return ipArray(0)
            End If

        End Function      
        
    

JSP:
        String ipAddress = request.getHeader("X-FORWARDED-FOR");
        if(ipAddress == null)
        {
            ipAddress = request.getRemoteAddr();
        }
        out.println("ipAddress:" + ipAddress); 
    

Java Servlet:
        public void GetIPAddress(HttpServletRequest req,
            HttpServletResponse res) 
        throws IOException {
          String IP = req.getRemoteAddr();
          return IP;
        }
    

Java:
        import java.net.*;
        import java.io.*;
        
        public class GetIPAddress {
            public static void main(String [] args) {
            try {
                InetAddress thisIp =InetAddress.getLocalHost();
                System.out.println("IP:"+thisIp.getHostAddress());
                }
                catch(Exception e) {
                    e.printStackTrace();
                }
            }
        }