worldcomingtoanend Posted May 13, 2010 Share Posted May 13, 2010 I only know how to extract public ip addresses using this: $_SERVER['REMOTE_ADDR']; $_SERVER['SERVER_ADDR']; but i need a way to extract a pc ip address...I need this to do a condition for a service available to the local intranet members. thank you.. Link to comment https://forums.phpfreaks.com/topic/201654-how-do-i-extract-a-local-client-pc-private-ip-address-with-php/ Share on other sites More sharing options...
taquitosensei Posted May 13, 2010 Share Posted May 13, 2010 You can't with php because php is server side so it can't see the local lan for your client. You may be able to with javascript. Link to comment https://forums.phpfreaks.com/topic/201654-how-do-i-extract-a-local-client-pc-private-ip-address-with-php/#findComment-1057869 Share on other sites More sharing options...
kenrbnsn Posted May 13, 2010 Share Posted May 13, 2010 This might be of some use to you: <?php if ($_SERVER["HTTP_X_FORWARDED_FOR"] != ""){ $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; $proxy = $_SERVER["REMOTE_ADDR"]; $host = @gethostbyaddr($_SERVER["HTTP_X_FORWARDED_FOR"]); }else{ $IP = $_SERVER["REMOTE_ADDR"]; $host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]); } ?> Ken Link to comment https://forums.phpfreaks.com/topic/201654-how-do-i-extract-a-local-client-pc-private-ip-address-with-php/#findComment-1057871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.