What's my IP in PHP
-
Hi, I'm writing a PHP script that runs on my computer, and I was wondering if anyone knows how to retrieve the internet IP of my computer (even if it's behind a router). I tried using gethostbyname('localhost'); and gethostbyname('MYCOMPUTERNAME');, both simply return the IP of the computer within the network. Joel Holdsworth
-
Hi, I'm writing a PHP script that runs on my computer, and I was wondering if anyone knows how to retrieve the internet IP of my computer (even if it's behind a router). I tried using gethostbyname('localhost'); and gethostbyname('MYCOMPUTERNAME');, both simply return the IP of the computer within the network. Joel Holdsworth
I'm having the same problem...I used ipconfig though...which works for all computers inside my home's router but nothing appears to work when entered remotely If you figure it out lemme know please... The word of the day is legs, let's go back to my house and spread the word ;P
-
Hi, I'm writing a PHP script that runs on my computer, and I was wondering if anyone knows how to retrieve the internet IP of my computer (even if it's behind a router). I tried using gethostbyname('localhost'); and gethostbyname('MYCOMPUTERNAME');, both simply return the IP of the computer within the network. Joel Holdsworth
You need to have another server (outside of your network) that you can access to get your external IP (or, as an alternative, a program running on your router that you can query). There are quite a few servers on the web that you can query to get your external IP as seen by the Internet (the first is the easiest to query, but you may want others to fall back on in case the first is down): http://www.phpfreaks.com/myip.php[^] http://www.whatismyip.com/[^] http://www.networkports.net/yourip.php[^] - Mike
-
You need to have another server (outside of your network) that you can access to get your external IP (or, as an alternative, a program running on your router that you can query). There are quite a few servers on the web that you can query to get your external IP as seen by the Internet (the first is the easiest to query, but you may want others to fall back on in case the first is down): http://www.phpfreaks.com/myip.php[^] http://www.whatismyip.com/[^] http://www.networkports.net/yourip.php[^] - Mike
way cool...thank you :) The word of the day is legs, let's go back to my house and spread the word ;P