(The following is backstory, you can jump down to "Question:" if you'd like)
There's a webpage for one of my courses that accepts input text (expected to be Python code) and then gives some tokenized response. It's meant to be used as a reference for the Python lexers we're writing. I'm trying to automate my testing process and be able to check my code without opening a browser, copying text back and forth, etc. So here's what I'm trying to do:
I've got a sample python file named "x.py" and I want to post it to the server as if I had filled out that form. I've tried:
curl --data-urlencode "firstname.lastname@example.org" http://matt.might.net/apps/pylex/pylex.php
But unfortunately, that's not working right because apparently
"@x.py" is getting posted as my file contents (that is,
"email@example.com" is what's getting posted, not
"file=<contents-of-x.py>"). I've tried
--data but those haven't worked either.
Specifically, if I have a file with non-url-encoded contents, and the contents of this file needs to be part of a POST and associated with a particular name (in this case,
file), what's the correct way of accomplishing this?