Submitting Homework without using a Browser

If your machine has access to the curl program then you can use curl command to fill in the homework submission form for you. This can be a great help if the machine you are developing on does not have browser access but does have curl and a terminal window in which to type the command.

A Scripting Approach

Here is a script that you can use.

STEP 0: Be in a terminal window on machine with curl installed. Be in the directory of the file you which to submit to the homework submit page. What we are going to do is access "the program that processes the form on the submit page" using a cool program called curl

STEP 1: put the following lines of code into the file curlsubmit.


#!/bin/sh
name=$1
ass=$2
file=$3

curl -F student=$name -F assignment="CS445 F20 Assignment $ass" -F "submittedfile=@$file" "https://engr-sonic-01.engr.uidaho.edu/cgi-bin/fileCapture.py" --user $name

Note: spacing inside quoted strings is very specific!
Note: assignment string is the string taken straight from the possible assignment options in the drop down menu on the submit page. A different class or different semester and the string will be different. In the example above the class is CS445 in the semester is Spring of 2014 or S14. The string in the pull down menu is the final arbiter of what is correct for a given assignment.

STEP 2:

Set permissions on the curlsubmit file to be executable. On a unix machine that would be:

chmod u+x curlsumit

STEP 3:

Either leave the file in the same directory as the file you want to submit or put the file in your scripts or bin directory which is in your PATH.

STEP 4:

Then, for example, if your name is napoleon, your working on assignment number 1, and the file you want to submit is in the file tree.tar then you type:

curlsumit napoleon 1 tree.tar
If . is not in your PATH then type this instead:
./curlsumit napoleon 1 tree.tar

A Direct Curl Call

For the above example you could make the call without the script as:
 
curl -F student=napoleon -F assignment="CS445 F20 Assignment 1" -F "submittedfile=@tree.tar" "https://engr-sonic-01.engr.uidaho.edu/cgi-bin/fileCapture.py" --user napoleon
The script seems to hide a lot of this mess but this way you don't have to maintain a script.

Have fun

Hopefully this will save you time when you are on a machine that does not have a browser. Have fun!

Note that the web interface will tell you what assignments are available for submission. The testing software is often installed later than the assignment is made. If you are doing a curl submit make sure the testing software is available before you submit.


Robert Heckendorn Up One Level Last updated: Mar 11, 2010 9:28