cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: setting a new cookie in curl

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 5 Dec 2005 23:21:14 +0100 (CET)

On Mon, 5 Dec 2005, Colleen R. Dick wrote:

> Hello this time I have a simple question. I want my curl to send along a
> brand new cookie that I just made up. It isn't complicated at all but the
> application is very picky about where it is. If I were doing it from inside
> I would normally have to say

> setcookie("custom","value",NULL,"/",".mydomain.com")

I don't think PHP/CURL offers any interface to the COOKIELIST option that
recent libcurls provide. It allows exactly that operation.

> The question if I want to use CURLOPT_COOKIE, then the data goes right
> in the code (YES??)

The data goes right into the request header, yes.

> but what is the format of it!!

name=contents

or if you want to send two cookies:

name1=contents1; name2=contents2

> if I put it in a file and use cookiefile, then would that be Netscape format
> like when you receive a cookie jar?

Yes. cookiefile understands both netscape format and plain HTTP header format.

> I'm sorry to have to ask this but I don't google very many curl examples all
> the ones so far that use CURLOPT_COOKIE are either only specifying a cookie
> value (and not path or domain)

Outgoing cookies have only name and value; no path and no domain.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-12-05