arvnd86 Posted May 7, 2013 Share Posted May 7, 2013 Hi to all, How to capture client local machine ip using javascript or php code. Quote Link to comment https://forums.phpfreaks.com/topic/277741-php-coding-lan-ip/ Share on other sites More sharing options...
PravinS Posted May 7, 2013 Share Posted May 7, 2013 Using PHP $_SERVER['REMOTE_ADDR'] also refer http://php.net/manual/en/reserved.variables.server.php Quote Link to comment https://forums.phpfreaks.com/topic/277741-php-coding-lan-ip/#findComment-1428798 Share on other sites More sharing options...
arvnd86 Posted May 7, 2013 Author Share Posted May 7, 2013 Using PHP $_SERVER['REMOTE_ADDR'] also refer http://php.net/manual/en/reserved.variables.server.php Yes but i need to fetch local lan machine ip... Quote Link to comment https://forums.phpfreaks.com/topic/277741-php-coding-lan-ip/#findComment-1428807 Share on other sites More sharing options...
DarkKnight2011 Posted May 7, 2013 Share Posted May 7, 2013 If you want to get the ip address of a local machine accessing your website then that previous code will still work, if your trying to the ip address of the machine your website is running on try this... $localIP = gethostbyname(trim('hostname')); I think it only works on linux though Quote Link to comment https://forums.phpfreaks.com/topic/277741-php-coding-lan-ip/#findComment-1428818 Share on other sites More sharing options...
kicken Posted May 7, 2013 Share Posted May 7, 2013 Yes but i need to fetch local lan machine ip... You can't, not from a remote network anyway. If you're accessing a site on the LAN then their IP would be in the $_SERVER['REMOTE_ADDR'] variable. If your site is on the internet though then there is nothing you can do to get their LAN IP, only their public IP. Quote Link to comment https://forums.phpfreaks.com/topic/277741-php-coding-lan-ip/#findComment-1428846 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.