cURL / Mailing Lists / curl-users / Single Mail


RE: project

From: Daniel Stenberg <>
Date: Wed, 8 Jan 2003 12:01:26 +0100 (MET)

On Wed, 8 Jan 2003, G G wrote:

> Wouldn't it be nice if I were able to pay my bills in a totally automated
> way from my home PC via my bank's website?

It is certainly possible, and I once upon the time wrote the initial SSL
certificate code when running curl against my online bank...

> I think a tool like curl would allow me to do that. But not being
> experienced programming for curl, I need the guidance of the curl gurus to
> get where I want to be. My first hurdle is the following: All my credit
> card web links and my Wells Fargo account have an initial account number
> /password form which can easily be filled using POST form fill-ins. But
> right after submitting this first form, a SESSION gets created. Is there a
> way to grab this session super-long string, so I can keep using it for
> subsequent maneuvering inside the deeper reaches of the website?

Well, when I do automated stuff like this, I usually write a perl script to
take care of it. Invoke curl, fetch the resulting HTML and scan it for the
stuff you're interested in. Use the extracted data in subsequent curl command
lines. Loop.

> I don't think this session string should be confused with a cookie.

Well, they most likely use cookies as well. Most sites like that do.

> Could you give me a concrete example, please, of an analogous situation
> that requires session management for subsequent requests.

Most sites that do session management use cookies for keeping the session.
Use -c to store cookies, and -b to load them:

  curl -b cookies.txt -c cookies.txt [URL]

If you need to login, and then follow a URL that contains a session-part that
is dynamicly generated, well then you need to write a program that can figure
out which URL to get, like:

 curl -d "user=daniel&password=bankaccount" -c cookies.txt [URL] -o \

 grep href logindump.txt (grep won't suffice of course)

 curl -c cookies.txt [extracted URL]

> Perhaps I haven't done enough reading yet and the answer is in some FAQ
> elsewhere in the documentation! , so, being a newbie here, I ask
> understanding and patience from you, the enlightened, experienced crowd.

I think you can get a first feeling for it by reading "The Art Of Scripting
HTTP Requests Using Curl" document:

 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
Received on 2003-01-08