cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Maintaining session with Post

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 24 Jan 2007 08:57:51 +0100 (CET)

On Tue, 23 Jan 2007, Spammed TooMuch wrote:

> This allows me to get session started and then get the second page with the
> authentication. However, now I want to do a Post and can't figure out how to
> do it. The first think I tried was to simply replace the second url with
> the post options and action URL:
>
> curl -u admin:admin --url http://192.168.0.1 -d "CFM=submit&ABC=1"
> http://192.168.0.1/DOACTION

curl cannot do first GET then POST on the same command line. You need to
invoke it twice.

> It is strange, and not mentioned why, that when faking a post you don't use
> the --url; every example has just the URL without the CLI keyword.

You never need "--url" outside config files, but you may use it.

> Tried passing the login info as part of 1 or both URLs. Saving cookies with
> -D or -b and then using -c in a second curl call doesn't help.

Using -b and -c (and -L of course) and doing two separate curl invokes is
usually what's needed in similar cases.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-01-24