sunchess
Новичок
Curl CURLOPT_COOKIEJAR
Не могу понять, в мане написано, что при выставлении
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
Все кукисы должны сохраняться в этот файл, но почемуто не сохраняет, в чем может быть причина?
ниже полный код
Не могу понять, в мане написано, что при выставлении
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
Все кукисы должны сохраняться в этот файл, но почемуто не сохраняет, в чем может быть причина?
ниже полный код
PHP:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEJAR,'cookie.txt');
curl_setopt($ch, CURLOPT_HEADER, TRUE);
//if isset ref
if($ref!='')
curl_setopt($ch, CURLOPT_REFERER, $ref);
//if isset cookie
if($cookie!='')
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$content = curl_exec($ch);
print_r(curl_getinfo($ch));
if(curl_error($ch))
{
echo "\n\ncURL error:" . curl_error($ch);
echo "\n\ncURL error:" . curl_errno($ch);
//$flagerrcurl = true;
}
curl_close($ch);