Re: cURL: can't prevent url redirect
| From: | Andrew Warner | Date: | Thu, 30 Nov 2006 05:26:15 +0000 |
| Subject: | Re: cURL: can't prevent url redirect | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-245323@lists.php.net to get a copy of this message | ||
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);