curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Edit cookies easily?

From: Scott Ellentuch via curl-library <>
Date: Wed, 22 May 2019 09:52:46 -0400

On Wed, May 22, 2019 at 5:43 AM Rainer Canavan <>

> On Tue, May 21, 2019 at 10:45 PM Scott Ellentuch via curl-library
> <> wrote:
> >
> > Hi,
> >
> > Using PHP and curl_init/curl_setopt/curl_exec/curl_close.
> >
> > My need is that I contact, perform a login transaction
> there,
> > and then use the cookies returned for contacting
> to continue the transaction. Cookies are scoped to the FQDN.
> >
> > I could do the first bit, close up shop, readin/edit/write the cookie
> file, then do my second bit, but that seems SO crude. ;)
> >
> > Is there a way to cleanly either tell the program to ignore cookie
> domains completely or be able to gracefully edit the cookie domain without
> all the extra overhead?
> There's a user contributed note about using (reading / altering) the
> curl in-memory cookie jar in the php documentation for curl_setopt():
> If that doesn't work for you, you can bypass the entire curl cookie
> handling by reading the incoming Cookies from the response headers,
> and setting them again as request headers for the next request.
> rainer


Thanks. (Following the bottom posting lead. ;) )

That does solve what I described, but I didn't mention something... After
the initial transaction like that, the program quits (This is an Amazon
Alexa Skill) and when re-invoked needs to go against
<> until the session times out, then do that
whole thing over. I guess I can write them out after the first transaction

Would have been nice to manipulate in memory AND write out when closed. :)
I might just have to do all cookie handling in program. Not terrible, but
just wanted to see if there was an alternative.

Thank you, Tuc

Received on 2019-05-22