0

I have a local server on my local LAN running as a web server.

How can I access sites on that server with my public IP rather than my local network IP?

So when I echo "$_SERVER['REMOTE_ADDR']" from a PHP script I get my internet address not 192.168.xx.xx

Ameer Elsherif
  • 71
  • 2
  • 10
  • Is this a duplicate? * http://stackoverflow.com/questions/3003145/how-to-get-the-client-ip-address-in-php * http://stackoverflow.com/questions/15699101/get-the-client-ip-address-using-php – Haudegen Aug 05 '15 at 09:25
  • You state your server is local, therefore it will not be able to be accessed from an external IP – pokeybit Aug 05 '15 at 09:26
  • Besides that I actually don't get what you want to achive? Just in one sentence: You are trying to get the ip-Adress of the visitor and show/use it, right? – Haudegen Aug 05 '15 at 09:26
  • @Haudegen No it is not a duplicate. I' know how to get the visitor address what I'm looking for is different. I'm developing a new software which behaves according to visitor's country (determined from his/her IP address). So, I want to test it before uploading to the production server. Right now I'm just using hard coded value for the IP address in my code. I hope you get it now :) – Ameer Elsherif Aug 05 '15 at 10:10
  • Sorry, that I am not understandig this: So, which IP-Adress do you want to get now? :( – Haudegen Aug 05 '15 at 10:14
  • The same IP I get from whatismyip.com for example – Ameer Elsherif Aug 05 '15 at 10:16

0 Answers0