Submitting Homework without using a Browser

If your machine has access to 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. Here is a script that you can use.

STEP 0: be in a terminal window 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
class=$1
name=$2
ass=$3
file=$4

curl -F class=$class -F student=$name -F assnum="$class F07 Assignment $ass" -F "homeworkfile=@$file" http://marvin.cs.uidaho.edu/~heckendo/cgi-bin/hwSubmit.cgi


Note: spacing inside quoted strings is very specific!

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 you are in class CS210, 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 210 napoleon 1 tree.tar
If . is not in your PATH then type this instead:
./curlsumit 210 napoleon 1 tree.tar

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