Curl & cookies

From: Date: Sun, 09 May 2004 23:23:26 +0000
Subject: Curl & cookies
Groups: php.general 
Request: Send a blank email to php-general+get-185760@lists.php.net to get a copy of this message
Has anyone tried using curl to fetch a web page and cookies?
                                                                                                                                                                                        
<? $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, 'http://www.php.net'); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_COOKIEJAR,'cookie.txt'); curl_setopt ($ch, CURLOPT_COOKIE,1); $content = curl_exec ($ch); curl_close ($ch); $cookie = file_get_contents('cookie.txt'); print $cookie; ?>
                                                                                                                                                                                        
This works fine, and the cookie gets stored in the cookie.txt file, but it only ever returns 1 cookie. There should be 2 for php.net. Same with pretty much any other site. Are there any configuration items I'm missing for the cookie jar?
                                                                                                                                                                                        
-- Jason Morehouse (jm@netconcepts.com) Netconcepts LTD - Auckland, New Zealand

« previous php.general (#185760) next »