svsingh has asked for the wisdom of the Perl Monks concerning the following question:
my $url = "http://$ENV{'SERVER_NAME'}/$ENV{'REQUEST_URI'}";
When I moved my script to the production server, I discovered that REQUEST_URI is not in the environment. My test environment uses Apache and the production environment uses IIS.
Without upgrading the production server to Apache, is there a clean way to get the parameter list? I'm looking at the contents of %ENV, but nothing seems to have the parameters.
My current plan is to use $ENV{'PATH_INFO'} and loop through the parameters to create the URL (only if URI_INFO doesn't exists). The code would look something like:
my $url = "http://$ENV{'SERVER_NAME'}/$ENV{'PATH_INFO'}?"; foreach (param) { $url .= "&$_=" . param($_); }
Is there an easier or better way to do this? I've searched PM and the docs, but nothing's jumping out at me. Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Rebuilding GET Parameters without ENV{'REQUEST_URI'}
by matija (Priest) on Jul 01, 2004 at 17:50 UTC | |
Re: Rebuilding GET Parameters without ENV{'REQUEST_URI'}
by cees (Curate) on Jul 01, 2004 at 17:55 UTC | |
Re: Rebuilding GET Parameters without ENV{'REQUEST_URI'}
by svsingh (Priest) on Jul 01, 2004 at 18:07 UTC |