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/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php