+91-943-185-6038 me@shashidharkumar.com

Get IP address
By ASP <%= Request.ServerVariables(“REMOTE_ADDR”) %>
By PHP <?php echo $ip=$_SERVER[‘REMOTE_ADDR’]; ?>

By JAVA
import java.net.*;
import java.io.*;
import java.applet.*;

public class GetClientIP extends Applet {
public void init() {
try {
InetAddress thisIp =
InetAddress.getLocalHost();
System.out.println(“IP:”+thisIp.getHostAddress());
}
catch(Exception e) {
e.printStackTrace();
}
}
}

//HTML Page
<HTML><HEAD></HEAD><BODY>
<APPLET CODE=”GetClientIP.class”
HEIGHT=10 WIDTH=10>
</APPLET>
Check JAVA console for output
</BODY></HTML>

BY Coldfusion

<cfoutput>#CGI.REMOTE_ADDR#</cfoutput>

BY CGI
import cgi
import os

print “Content-type: text/html”
print “”

print cgi.escape(os.environ[“REMOTE_ADDR”])

See also  ASP-Interview Question