Re: Geting the Host from URL in cgi script
- From: noreply@xxxxxxxxx (Gunnar Hjalmarsson)
- Date: Fri, 28 Mar 2008 15:28:43 +0100
Gunnar Hjalmarsson wrote:
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} ...
Or do you just want
my ($host) = $uri =~ m#://(.+?)[:/]#;
Your initial post leaves room for various interpretations. :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.
- References:
- Geting the Host from URL in cgi script
- From: Sivasakthi
- Re: Geting the Host from URL in cgi script
- From: Gunnar Hjalmarsson
- Geting the Host from URL in cgi script
- Prev by Date: Re: Handling OLD files
- Next by Date: Install CPAN module in shared hosting
- Previous by thread: Re: Geting the Host from URL in cgi script
- Next by thread: Install CPAN module in shared hosting
- Index(es):
Relevant Pages
|