10-21-2009, 01:38 PM
You can get your external ip with perl by running this script...however, you have to install the LWP::Simple first. If you are on mac or linux you can simply go to the command line and type:
sudo cpan
You may have to set up cpan, for the most part you use all defaults, and choose servers near you.
then run
install LWP::Simple
cpan may ask you some more questions, just agree.
Then you can run this:
If you don't know your path to perl(#!/usr/bin/perl) then run it by typing
perl nameofscript.pl
sudo cpan
You may have to set up cpan, for the most part you use all defaults, and choose servers near you.
then run
install LWP::Simple
cpan may ask you some more questions, just agree.
Then you can run this:
PHP Code:
#!/usr/bin/perl
use LWP::Simple;
$whyip = qr/(Your IP address is \d+\.\d+\.\d+.\d+)/;
$content = get("http://whatismyipaddress.com");
if($content =~ $whyip){
print $&;
}
If you don't know your path to perl(#!/usr/bin/perl) then run it by typing
perl nameofscript.pl