FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Show ip adress from perl -script need help





svecia
I did a script that shows my ip :
use Socket;
use Sys::Hostname;
my $host = hostname();
my $addr =inet_ntoa(scalar gethostbyname($host || 'localhost'));

It shows my ip adress on the machine connected to internet , but the
machine connectet trough the local network just shows
127.0.0.1
I dont need to do it in perl, I could use shell instead.
manumiglani
Code:
#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

print "<html><head><title>IP Address Display</title></head><body>\n";
print "<h1>IP Address Display</h1>\n";

$ip = $ENV{'REMOTE_ADDR'};

print "You are using ip address $ip\n";
print "<p>\n";
print "</body></html>\n";


or you could do that in php as well

Code:
$ip=@$REMOTE_ADDR;
echo "<font face='Verdana' size='3'><b>IP Address= $ip</b>";
Related topics
executing a perl script
CGI/Perl Script to backup a website.
I have a perl Script.. but i dont know how to use.
Running a Perl script in the background
HELP needed with basic Email perl script.
im installing a perl script in my website and..
ip-adress.com
executing a perl script from within a script
TCP Port
php script help!
writing COM components in Perl
PERL - post data from one script to another (Without LWP)
Sending simple emails using PERL - Help required
Problem with perl script
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.