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


Cookie jar problem

From: Andrey Kravchuk <>
Date: Mon, 21 Nov 2005 14:34:38 +0200

Got a strange problem with storing cookies during login process
POST looks like this:

$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_HEADER, true);
curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_COOKIEJAR, $this->cookie_jar);

curl_setopt($this->ch, CURLOPT_POST, true);
curl_setopt($this->ch, CURLOPT_HTTPGET, false);
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_REFERER, $this->last_url);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);

 $this->last_reply = curl_exec($this->ch);

The headers i receive in reply look like this:

HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Mon, 21 Nov 2005 12:23:06 GMT

HTTP/1.1 302 Object Moved
Server: Microsoft-IIS/5.0
Date: Mon, 21 Nov 2005 12:23:06 GMT
Connection: close
Content-type: text/html
Cache-Control: private
Expires: Thu, 30 Sep 1999 01:29:07 GMT
Pragma: no-cache
Page-Completion-Status: Normal
Set-cookie: VAR=VALUE;; path=/; HttpOnly
Page-Completion-Status: Normal
Set-Cookie: VAR2=VALUE2
...and some more cookies here

And cookie jar file is not created after that. Not a file permissions
issue - in all other cases cookie jar file is created.

CURL Information libcurl/7.11.2 OpenSSL/0.9.7g zlib/1.1.4

Received on 2005-11-21