CSecurity
asked on
PERL CGI Get all GET parameters and put them together
I want to get ALL parameters of GET method and put them together in a single string variable...
ex.
If Test.pl?a=1&b=2&c=3&d=%20T est%20 called
I want to have a=1&b=2&c=3&d=%20Test%20 in a single string variable in same format with & and html encoded.
Thanks from now!
ex.
If Test.pl?a=1&b=2&c=3&d=%20T
I want to have a=1&b=2&c=3&d=%20Test%20 in a single string variable in same format with & and html encoded.
Thanks from now!
You could just get the $ENV{QUERYSTRING}, and this would be exactly the querystring to your script.
ASKER
I want URL and parameters all together
I mean:
http://www.mysite.com/test.pl?a=1&b=2&c=3&d=%20Test%20
I want entire URL
I mean:
http://www.mysite.com/test.pl?a=1&b=2&c=3&d=%20Test%20
I want entire URL
$ENV{REQUEST_URI}
my $EntireURL = "http://www.mysite.com/test.pl?$ENV{QUERY_STRING}"
ASKER
There isn't a method to get it dynamically?
The REQUEST_URI will not contain the protocol (http), or the domain (www.mysite.com). And if the current page is different from the desired link, it will not be correct.
my $EntireURL = "$ENV{REQUEST_URI}?$ENV{QU
What do you want to get? There are several environment variables that contain different parts of what you are asking for.
I meant SCRIPT_URI
my $EntireURL = "$ENV{SCRIPT_URI}?$ENV{QUE RY_STRING} " ;
my $EntireURL = "$ENV{SCRIPT_URI}?$ENV{QUE
SCRIPT_URI? I don't have this - I am using apache... what webserver are you using?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm using apache 2.2.8, which looks to be the newest release.... wondering if SCRIPT_URI is a non-standard add-on your host is using.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
With 2.2.8.... I meant 2.2 is the latest - there is a 2.2.9 released on 2008-06-13, but I doubt this would have changed.
Thanks FishMonger!