我试图从外部页面获取所有 cookie 并将它们设置在我的页面中,我有这个脚本:
$url = "http://www.booking.com/hotel/cz/red-blue-design-prague.html?checkin=2012-07-07&interval=1&selected_currency=USD";
$ckfile = tempnam ("tmp", "CURLCOOKIE");
$options = array(
CURLOPT_RETURNTRANSFER => TRUE, // return web page
CURLOPT_HEADER => TRUE, // do not return headers
CURLOPT_HEADER => TRUE, // do not return headers
CURLOPT_FOLLOWLOCATION => TRUE, // follow redirects
CURLOPT_USERAGENT => "googlebot", // who am i
CURLOPT_AUTOREFERER => TRUE, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 3, // stop after 10 redirects
CURLOPT_ENCODING => 'UTF-8',
CURLOPT_COOKIEJAR => $ckfile,
CURLOPT_COOKIEFILE => $ckfile
);
$ch = curl_init();
curl_setopt_array( $ch, $options );
curl_setopt($ch, CURLOPT_URL, $url);
$a = curl_exec($ch);
但是当我检查时它没有得到cookie $ckfile
,有人可以帮忙吗,谢谢