cURL / Mailing Lists / curl-users / Single Mail


Re: How to accomplish a simple login?

From: Daniel Stenberg <>
Date: Thu, 4 Apr 2002 09:03:58 +0200 (MET DST)

On Mon, 1 Apr 2002, John Mann wrote:

> I am trying to use a set of curl commands in a shell script to archive my
> delphi discussion forum. Before I can get to the actual messages, I have
> to go through a login screen. After much pain, I was able to get curl to
> use a Netscape cookie to bring up the login screen with my username already
> entered, but with a seemingly blank password. If I was using Netscape, at
> this point I would simply type in my password and click the "Login" button.
> Then I would be able to move on and start browsing the messages. I tried
> looking at the documents to learn how to simulate this login using curl,
> but I can't figure it out. The form at Delphi seems more complicated than
> the ones used in the example documentation.

The form you showed includes javascript "magic", which confuses a casual
reader and makes things slightly more tricky.

However, I'll let you in on a good advice: save the HTML page locally, then
edit the <form> tag you're about to play with to use method="GET" instead of
a POST and then use your browser to fill in the form as usual (loading your
local copy of the html).

A GET form then shows everything in the URL (when submitted), that would
otherwise have been put in the disguised POST action.

Then you put that info in a POST request made by curl instead, and voila, it
often works...

Good luck!

    Daniel Stenberg -- curl groks URLs --
Received on 2002-04-04