Reputation: 15059
I've wrote CGI script for www.
This script expects two parameters through GET method, multiply these numbers and write result into the file.
mult.cgi?m=1&n=2
But now I want to use this script from console too. I'tried something like
./mult.cgi?m=1&n=2
But it didnt work, how can I send parameters to script?
thanks.
Upvotes: 3
Views: 8000
Reputation: 18531
You could try:
telnet hostname 80
GET /path/to/script/mult.cgi?m=1&n=2
Which emulates a port 80 (www) connection to the server and executes the script with given parameters.
Upvotes: 0
Reputation: 15780
It acts out like a perl script. (correct me if I'm wrong here)
So if you want to run it via the console:
perl mult.cgi 1 2
as for the parameters, you need to convert it to: $ARGV[1]
and $ARGV[2]
..
NOTE $ARGV[0]
is the cgi script (filename) in this case.
Also, you might be required to put: #!/usr/bin/perl
at the very top of the cgi script.
Upvotes: 0