Link to home
Start Free TrialLog in
Avatar of CSecurity
CSecurityFlag for Iran, Islamic Republic of

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=%20Test%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!
Avatar of Adam314
Adam314

You could just get the $ENV{QUERYSTRING}, and this would be exactly the querystring to your script.
Avatar of CSecurity

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
Avatar of hielo
$ENV{REQUEST_URI}
my $EntireURL = "http://www.mysite.com/test.pl?$ENV{QUERY_STRING}"
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{QUERY_STRING}" ;
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{QUERY_STRING}" ;
SCRIPT_URI?   I don't have this - I am using apache... what webserver are you using?
ASKER CERTIFIED SOLUTION
Avatar of Adam314
Adam314

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!