cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Post File to HTTPS via cURL at command line

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Tue, 14 Jun 2005 18:45:01 -0500

Here's some stuff to get you started:

On 6/14/05, Amy Petri <Apetri_at_geneoswealth.com> wrote:
>
> https://www.somesite.com/template/login
>
> POST /template/login HTTP/1.1
> Cookie: FDX=
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 48
> user=username&password=password&switch=Log+In

The above couple of lines are the form data being posted back, and the
Cookie line tells you that you'll probably need to track cookies, so
at the minimum this first block reduces to something like this:

curl -b cookies -c cookies -d
"user=username&password=password&switch=Log+In"
https://www.somesite.com/template/login

You can ignore the icons:
 
> GET /icons/logo.gif HTTP/1.1
> GET /icons/dir.gif HTTP/1.1
> GET /favicon.ico HTTP/1.1

> https://www.somesite.com/incoming/?T
>
> GET /incoming/?T HTTP/1.1

Follow on with:

curl -b cookies -c cookies "https://www.somesite.com/incoming/?T"

> https://www.somesite.com/incoming
>
> POST /incoming HTTP/1.1
> Content-Length: 194
> Content-Disposition: form-data; name="File"; filename="test.txt"
> Content-Type: text/plain
>

And finally:

curl -b cookies -c cookies -F File=@test.txt https://www.somesite.com/incoming

though Ive never done a file upload, so that may be a little shaky... :)

That may not be the whole story, but it should get you nearer to where
you need to be.

Ralph Mitchell
Received on 2005-06-15