Re: cURL: can't prevent url redirect

From: Date: Thu, 30 Nov 2006 05:34:58 +0000
Subject: Re: cURL: can't prevent url redirect
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-245324@lists.php.net to get a copy of this message
Andrew Warner wrote:
Actually, the problem is that the site isn't recognizing my cookies. Is there anything wrong with the below code? Same thing in Snoopy works perfectly. Going to stick with Snoopy. $the_headers = array( "Language: en", "Accept: */*", "User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3", "Content-type: text/html" ); $restored_cookies = restore_cookies (); foreach($restored_cookies as $name=>$value)
     array_push($the_headers, "Cookie: ".$name.'='.$value);
// headers look good: echo '<pre>'; print_r($the_headers); echo '</pre>'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, $the_headers); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch);
Curl uses different cookie options. See CURLOPT_COOKIE, CURLOPT_COOKIEFILE and CURLOPT_COOKIEJAR on http://www.php.net/manual/en/function.curl-setopt.php -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#245324) next »