SPUG: Get the local IP address?
DeRykus, Charles E
charles.e.derykus at boeing.com
Wed Jul 20 15:49:42 PDT 2005
>I'm trying to write a script what will give me the host name ( from DNS )
> for whatever machine it is run on. The stumbling block is getting the
> local IP address.
> Can anybody give me clues to how I can grab the local IP address of the
> computer, given an arbritrary number of interfaces (but only one of them
> has an IP address)?
> And once I have the address, I can do this, right?
> $hostname = gethostbyaddr(inet_aton($address), AF_INET)
Any reason you must get an IP-to-name translation rather than just using
More information about the spug-list