php curl函数不保存cookie(cookie文件:空)

时间:2013-05-20 13:43:41

标签: php

我有问题," PHP " cURL功能不保存cookie!

卷曲功能:

$file['cookie'] = "cooki";
function cURL_Page($url='',$var=''){
    global $file;
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT,20);
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
    curl_setopt($curl, CURLOPT_REFERER, "http://www.libertyreserve.com/en/login");
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    if($var) {
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $var);
    }
    curl_setopt($curl, CURLOPT_COOKIE,$file['cookie']);
    curl_setopt($curl, CURLOPT_COOKIEFILE,$file['cookie']);
    curl_setopt($curl, CURLOPT_COOKIEJAR,$file['cookie']);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 3);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    $result = curl_exec($curl);
    curl_close($curl);
    return $result;
}
文件中的

" cooki"没有结果

p.s:我卷曲了一个https页面

感谢所有

0 个答案:

没有答案