Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

The Environment variable for URL...

by SYbeginner (Novice)
on May 22, 2000 at 06:36 UTC ( [id://14131]=perlquestion: print w/replies, xml ) Need Help??

SYbeginner has asked for the wisdom of the Perl Monks concerning the following question:

Is there an environment variabe that displays the URL of the current webpage?

Replies are listed 'Best First'.
Re: The Environment variable for URL...
by lhoward (Vicar) on May 22, 2000 at 06:53 UTC
    This question would probably be more apropriate to a discussion forum related to your webserver. However, in the spirit of Perlmonks I offer you a short perl/CGI script that will show you all the environmental variables that are available so you can see if you can find one that suits your needs.
    #!/usr/bin/perl -w use strict; use CGI qw(:standard); print header, start_html(-title => 'ENV vars', -bgcolor => 'white'); foreach (sort keys %ENV){ print "<b>$_</b> -> \"$ENV{$_}\"\n<br>\n"; } print end_html;
      Or the non-CGI.pm version of the above...
      #!/usr/bin/perl print "Content-type: text/html\n\n"; print "<html><body><pre>\n"; foreach (sort keys %ENV) { print "\$ENV{$_}\t$ENV{$_}\n"; } print "</pre></body></html>\n\n";
Re: The Environment variable for URL...
by httptech (Chaplain) on May 22, 2000 at 15:29 UTC
    Or the non-HTML version of the above...
    #!/usr/bin/perl print "Content-type: text/plain\n\n"; print map { "$_ : $ENV{$_}\n" } sort keys %ENV;
      #!/bin/sh echo content-type: text/plain echo printenv
Re: The Environment variable for URL...
by Maqs (Deacon) on May 22, 2000 at 18:26 UTC
    Or the exact names of some of the variables:
    HTTP_HOST i.e. "some.where.com"
    REQUEST_URI i.e. "/page/file.cgi"

    /Maqs.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://14131]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2025-07-10 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.