> Any ideas is it possible to read the address bar through perl alone?

I'm going to assume that you would like perl to retrieve the information
that maybe displayed in the address bar of a web-browser, should it have
one. I am also assuming that your referring to a recent Mozilla variant...
i.e. Mycrowsnot Internet Exploder 6+, Netscrape Navigator 6+ or Mozilla 1.1+
as this encompasses about 99.9% of the people who hit my own sites. Most of
this information, as Thomas said, can be found in the environment variables.
I'm going to demonstrate with an Apache HTTP/1.1 Server running on a FreeBSD
box, using Perl 5.

Firstly... a protocol is needed... most often this is http://, although
there's lots to choose from this is stored in the $ENV{SERVER_PROTOCOL}
variable. Next will be the host or server name. These can result in
different values dependant upon how your server is configured, but generally
$ENV{SERVER_NAME} will get you the domain name that is being used to execute
the perl script, whilst $ENV{SERVER_ADDR} usually gets you the IP address.
Next you need the path to the script, now I'm going to assume you want the
relative path from the web-server [domain.tld], not the absolute path from
the root [/] so this may be something like "/cgi-bin/env.pl" and would be
stored in $ENV{SCRIPT_NAME}. If you also want to retrieve any 'GET'
parameters passed to the script then you may prefer to choose
$ENV{REQUEST_URI} instead.

Bare in mind, I am making huge assumptions here about your usage (so forgive
me if I advise you incorrectly), but perhaps this may help you, if not, I
hope it will give you a good start:

$addressbar = "http://"; . $ENV{SERVER_NAME} . $ENV{REQUEST_URI}

All of these variables can usually be found in the Perl Environment table.
The perl environment table can be displayed simply by the following script:

-- begin "env.pl" script --
#!/usr/bin/perl
#########################
### Print Environment ###
#########################
print "Content-type: text/plain\n\n";
while ( ($key, $value) = each(%ENV) ) {
        print "$key = $value";
}
exit;
-- end "env.pl" script --

PS If your putting that script on one of the AIB's server's don't leave it
there too long. It reveals too much about a server's configuration and
someone untrustworthy could take advantage of it.

Hope that helps, just ask if you need more pointers...

Kindest Regards, White Rabbit.
How deep does the rabbit hole go: http://szlamp.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to