On Sat, 24 Nov 2007 16:38:21 +0100
"Jenda Krynicky" <[EMAIL PROTECTED]> wrote:

> From:                 doubleHelix <[EMAIL PROTECTED]>
> > ok i know how i can find my INERNAL ip address in a script with perl:
> > 
> > use Socket;
> > print inet_ntoa(inet_aton("")) ."\n";
> > 
> > but how would I find my EXTERNAL ip address?
> 
> Define external ... it's not as simple as it may sound. One 
> definition could be "the address that my HTTP requests seem to come 
> from". In that case:
> 
> 1) Find an external web page that displays the IP address
> 2) send a request to that page using LWP::Simple
> 3) parse the result

Tip: the best site for this is whatismyip.org, which returns a page
containing *nothing* but the IP address - no HTML, no parsing necessary.

> Jenda

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to