Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Parameters?

Posted on 1999-07-05
3
Medium Priority
?
128 Views
Last Modified: 2012-05-04
I'm a beginner in perl, and I'm not sure if it's possible.

I want to make a link, say: .../mydownloadscript?http://www.yy.com/file.zip

in other word, I want to pass the "http://www.yy.com/file.zip" argument to the script, and when I processed othet things in the script (like a counter or such), I want the browser to start downloading the file.

I know that I can just use the Print "Location: http://www.yy.com/file.zip\n\n" to start the download (probably) but I don't know how to get that link into the script...

Is it even possible? Thanks!
0
Comment
Question by:efortier
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1213887
$ENV{QUERY_STRING}
0
 
LVL 5

Expert Comment

by:prakashk021799
ID: 1213888
If you are asking how you could separate the part after the '?' from the link for the script, its easy.

When you are running this as a CGI script, the string after the '?' is already saved in the environment variable QUERY_STRING. So, all you have to do is:

print "Location: $ENV{QUERY_STRING}\n\n";

If this is not what you want, please clarify.
0
 
LVL 2

Accepted Solution

by:
helver earned 300 total points
ID: 1213889
If you want the link embedded in the URL, you'll need to escape the string that represents the link in order to pull out the characters that would confuse the URL.

I know there's a URI::escape() method that does it.  And I believe there is also a CGI::escape() method that will convert a string to a char sequence usable in a URL.  This would imply that you'd be willing to generate the page that contains the link as well.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question