Re: cURL: can't prevent url redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux