Re: Get your *own* IP...?!
| From: | info at t-host dot com | Date: | Tue, 07 Jan 2003 11:42:44 +0000 |
| Subject: | Re: Get your *own* IP...?! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130558@lists.php.net to get a copy of this message | ||
Hello all,
Oh my god
As a perl hacker I did it that easy way:
Please go to your Linux Bash-Shell. There you type:
MYIP=
/sbin/ifconfig ppp0 grep inet | cut -d: -f2 | cut -d" " -f1 ;
$MYIP has now your dyn IP Adress.
Best regards,
Oliver Etzel
---------------------------------------------------------------
info@t-host.de
Phone +49 89 54071102
New - .eu-Domains
Scriptinstallation Serverconfiguration Hosting Serverhousing Domains
www.t-host.de
---------------------------------------------------------------
----- Original Message -----
From: Chris Hewitt
To: Charles likes PHP
Cc: php-general@lists.php.net
Sent: Tuesday, January 07, 2003 12:22 PM
Subject: Re: [PHP] Get your *own* IP...?!
Charles likes PHP wrote:
>Does anyone know a way to fetch your own IP-adress? I need it because I run
>a web server on my computer with a dynamic-IP so I need it to change all the
>URLs it creates dynamically...
>
Maybe I'm not understanding your situation properly so please correct me
if I'm wrong. URLs should have the FQDN not IP address. DNS was created
so that fixed, easy to remember, names could be given to computers not
numbers. The numbers (IP address) may change.
If you are running a server, its hostname should be fixed, e.g.
mybox.myisp.com whilst its ip address may change.
I suggest that you use $_SERVER['SERVER_NAME'] in the URL. Its populated
with Apache under linux, but whatever you are using you should have a
way to get the hostname. Best if you are running a server is to get a
static ip address from your isp but few will have them these days (I'm
on a static IP address from Demon Internet). As long as your hostname
remains the same you will have little problem. Your isp should provide
forward DNS for your hostname (they should provide reverse too). Maybe
for dns you may need something like dyndns.org.
Some broadband ISPs use hostnames based upon the IP address e.g.
dsl-111.222.333.444.myisp.com. It saves them playing with DNS and are
intended for end users (who would usually have no problem with it as
they would not be trying to run a server).
Hope this helps.
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php