0

Possible Duplicate:
ip address of client system

I want to learn local IP address of client. I can do it with Java applet. But I don't want to do it with applet. Is there any method to know local ip with javascript?

Srishti Sinha
  • 618
  • 1
  • 11
  • 23
totali
  • 260
  • 6
  • 22
  • 2
    `javascript or jsp or php` - One of these things is not like the others. – David May 02 '11 at 12:55
  • I want take client local ip for security reasons – totali May 02 '11 at 12:57
  • 2
    I doubt there is any way to get the LOCAL IP of the client. There could be many network interfaces, browsers should not be allowed to get direct access to them. The only way I can think of is with Java as you mentioned or ActiveX under IE. – DarthJDG May 02 '11 at 12:58

2 Answers2

0

In PHP the user's IP is stored in _SERVER['REMOTE_ADDR']. In javascript, you can just call a php page with ajax that prints this information.

Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
  • 1
    $_SERVER['REMOTE_ADDR'] don't give me local ip address. I need client local ip such as 192.168.x.x – totali May 02 '11 at 12:58
  • In JQuery you can use this API $.getJSON("http://jsonip.appspot.com?callback=?", function(data){ alert( "Ip: " + data.ip); }); – totali May 02 '11 at 13:00
0

Look at this already answered question: How to get client's IP address using javascript only?. I think it'll get you where you want to go with Javascript.

This page shows you how to do it with PHP: http://www.teachmejoomla.net/code/php/remote-ip-detection-with-php.html.

Community
  • 1
  • 1
JToland
  • 3,630
  • 12
  • 49
  • 70