cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Tricky auto-login - help needed

From: Brian Dessent <brian_at_dessent.net>
Date: Sat, 28 Apr 2007 09:38:57 -0700

envision wrote:

> Command:
> curl -F username=myusername -F password=mypassword http://localhost/login.html
>
> Maybe I'm missing something here, but isn't this effectively the same thing I was doing in the browser?

No, it's not. You're POSTing the request to localhost, where it can't
possibly do any good. Remember that curl does not parse anything, so if
you are expecting it to parse login.html to find the FORM elements you
need to readjust your expectations. The destination that you give to
curl is the destination where you want the form to be POSTed (which you
can find by looking at the source to login.html) not the location
hosting the HTML of the FORM elements, which is meaningless.

As is often said here, just install LiveHTTPHeaders in Firefox and it
will show you exactly what is happening when you submit the form, then
recreate that with curl.

Brian
Received on 2007-04-28