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

curl-and-php

Re: HTTPS and cURL in PHP

From: Kirk Hedden <khedden_at_treefrogcreations.com>
Date: Fri, 03 Sep 2004 09:09:30 -0400

At 02:57 AM 9/3/2004, you wrote:
>Hi guys
>
>Many articles have been written about using cURL on different situations.
>
>I need to login to a https address, start a session and then download a
>particular file everyday.
>
>My Curl Options look like this
>
>$ch = curl_init();
>curl_setopt ($ch,CURLOPT_URL, $url);
>curl_setopt ($ch,CURLOPT_POST,1);
>curl_setopt ($ch,CURLOPT_POSTFIELDS, $data);
>curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
>curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName");
>
>but I keep getting this error : unable to save your session ID in a
>browser cookie. It needs to be able to do this in order to work properly.
>
>Do I need to send any headers? The cookie file can be just any file or
>must be a particular one?

Are you setting CURLOPT_COOKIEFILE as well as COOKIEJAR? If not, then add
this line:

curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieFileName");

 From the manual:

CURLOPT_COOKIEFILE The name of the file containing the cookie data. The
cookie file can be in Netscape format, or just plain HTTP-style headers
dumped into a file.
CURLOPT_COOKIEJAR The name of a file to save all internal cookies to when
the connection closes.

Best,
Kirk
Received on 2004-09-03