php cURL存储和使用cookie(cookies.txt)

时间:2013-12-20 08:37:29

标签: php cookies curl

我将cookie存储在cookie.txt中,使用curl在网站中导航,但是在这个cookie.txt中存储了这个:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

domain.com  FALSE   /   FALSE   0   SEI_PARTENON_JSESSIONID 0001tOlbY03I1FEsEv-QM-FhAKO:17o9dfuck

什么是假/错误

我认为这是错误的,因为网站总是说cookie错误。 !! !!

这是我的代码:

 $uagentutilitzat = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, "https://www.domain.com");
curl_setopt ($ch, CURLOPT_VERBOSE, 0); 
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLINFO_HEADER_OUT,true);
curl_setopt ($ch, CURLOPT_USERAGENT, $uagentutilitzat); 
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.txt"); 
curl_setopt ($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);

curl_setopt ($ch, CURLOPT_REFERER, "http://www.domain.com");
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS,'entradaDesde=AVISO_SEG_FIRMA&mensajeXML=&hojaEstilos=..%2F..%2FEstatico%2FComunesSEI%2FStyles%2Festilo_e.css&imagenes.flecha=flecha_e.gif');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output=curl_exec($ch);

THS !!!

0 个答案:

没有答案