Re: Geting the Host from URL in cgi script



sivasakthi wrote:
I have passed the one URL to cgi script , and i have retrieve the values
by using the param method..

the example url is following ,

http://172.16.2.30:2004/block/blocked.cgi?url=google.com&target=gambling

now i wanted to retrieve the host of
http://172.16.2.30:2004/block/blocked.cgi .. how i can able to get that?

my $hostname =
( gethostbyaddr pack('W4', split /\./, '172.16.2.30'), 2 )[0];

Or maybe you are simply looking for the CGI variable $ENV{HTTP_HOST} ...

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages