Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

How to pass paramaters to script without it haulting on :

by Anonymous Monk
on Sep 06, 2011 at 18:56 UTC ( [id://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 :

Replies are listed 'Best First'.
Re: How to pass paramaters to script without it haulting on :
by NetWallah (Canon) 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."

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)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-24 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found