Re: libcurl (cookies across cURL session). . .?
| From: | Richard Lynch | Date: | Tue, 26 Sep 2006 23:13:25 +0000 |
| Subject: | Re: libcurl (cookies across cURL session). . .? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242260@lists.php.net to get a copy of this message | ||
On Sat, September 23, 2006 1:10 am, Michael Williams wrote:
> Is there any way at all by which to persist cookies across cURL
> sessions? Basically I have a login page that sets cookies and looks
> for them for "logged in" status so that the user may use the site to
> their heart's content. The problem with cURL, however, appears that
> after the initial login, any further attempts are foiled by the fact
> that the cookies don't remain. How exactly should I go about doing
> this?
curl_setopt($curl, CURLOPT_COOKIEFILE,
'/full/path/to/php/writeable/file');
curl_setopt($curl, CURLOPT_COOKIES, '/full/path/to/php/writeable/file');
NOTE:
I probably got the CURLOPT_* thingies wrong. RTFM.
BUG:
If you are also trying to get the Headers with that other CURLOPT,
then curl just plain won't do the Cookies for you :-(
Then you have the joy of writing a header parser for getting the
Cookies, and sending out headers with your curl request to send the
cookies.
It can't be that tricky, cuz before I found the CURLOPT_* above, I
used to do that. :-)
--
Like Music?
http://l-i-e.com/artists.htm