From: Philip Hallstrom Date: 2006-10-25T13:03:16+09:00 Subject: Re: Best way to automate web browser tasks? >> curl? >> >> seriously - do you have to do it via firefox? >> > > No, I *don't* have to do it via FF or any other browser. > > Can curl do that sort of thing? I've never used it > except for simple sucking-down of pages. Yes. -F/--form (HTTP) This lets curl emulate a filled in form in which a user has pressed the submit button. This causes curl to POST data using the content-type multipart/form-data according to RFC1867. This enables uploading of binary files etc. To force the content part to be be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the letter <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file. Example, to send your password file to the server, where password is the name of the form-field to which /etc/passwd will be the input: curl -F password=@/etc/passwd www.mypasswords.com To read the files content from stdin insted of a file, use - where the file name shouldve been. This goes for both @ and < constructs. You can also tell curl what Content-Type to use for the file upload part, by using type=, in a manner similar to: curl -F "web=@index.html;type=text/html" url.com See further examples and details in the MANUAL. This option can be used multiple times.