Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Perl: the Markov chain saw
 
PerlMonks  

How to pass paramaters to script without it haulting on :

by Anonymous Monk
on Sep 06, 2011 at 18:56 UTC ( #924448=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Can someone help me get a string to work in a browser's ADDRESS bar when passed as a paramater?

My server allows me to do anything test.pl?param=adsasda&pasd=22222 however after thorough testing of some weird behavoir, it will NOT permit test.pl?param=http://www.test.com

I can get it to work as long as I remove the :. Anyone know why? Is there any easy way to encode my URL so other characters won't mess it up? I'll always call the script directly in the browser and call it through www::mechanize.

Ie: my $page = get("http://test.com/cgi-bin/script.pl?params_here....");

Comment on How to pass paramaters to script without it haulting on :
Re: How to pass paramaters to script without it haulting on :
by suaveant (Parson) on Sep 06, 2011 at 19:50 UTC
    URL::Encode comes to mind for encoding url values.

                    - Ant
                    - Some of my best work - (1 2 3)

Re: How to pass paramaters to script without it haulting on :
by NetWallah (Monsignor) on Sep 06, 2011 at 20:13 UTC
    RFC3986 Defines the URI syntax, and identifies "reserved characters" - i.e. those NOT PERMITTED in the querystring as:
    reserved = gen-delims / sub-delims gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
    So - you cannot use ":" and "//" without escaping them.

                "XML is like violence: if it doesn't solve your problem, use more."

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-04-20 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (487 votes), past polls