php - cURL gets less cookies than FireFox! How to fix it? -
how can make curl cookies?
i thought maybe firefox gets different cookies page loads or has built-in javascript sets cookies after page loaded, or maybe redirects other pages , other pages set other cookies, don't know how make curl same thing. set curl follow redirects still no success. curl sets cookies not of them.
following code use in php:
$url = 'https://www.example.com'; $handle = curl_init($url); curl_setopt($handle, curlopt_cookiesession, true); curl_setopt($handle, curlopt_returntransfer, true); curl_setopt($handle, curlopt_followlocation, true); curl_setopt($handle, curlopt_cookiejar, "cookies.txt"); curl_setopt($handle, curlopt_cookiefile, "cookies.txt"); curl_setopt($handle, curlopt_autoreferer, true); curl_setopt($handle, curlopt_useragent, 'mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; sv1; .net clr 1.0.3705; .net clr 1.1.4322)'); $htmlcontent = curl_exec($handle);
following live http header in firefox
get /index.ext http/1.1
host: www.example.com user-agent: mozilla/5.0 (macintosh; u; intel mac os x 10.6; en-us; rv:1.9.2.10) gecko/20100914 firefox/3.6.10
accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
accept-language: en-us,en;q=0.5
accept-encoding: gzip,deflate
accept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7
keep-alive: 115
connection: keep-alive
cookie: jsessionid=3e85c5d0436d160d0623c085f68dc50e.catalog2; __utma=137925942.1883663033.1299196810.1299196810.1299198374.2; __utmz=137925942.1299196810.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); citrix_ns_id=0pqdumy48kxtopcbps/qqc+w2vaa1; __utmc=137925942
http/1.1 200 ok
date: fri, 04 mar 2011 01:20:30 gmt
server: apache/2.2.15
keep-alive: timeout=5, max=100
connection: keep-alive
transfer-encoding: chunked
content-type: text/html;charset=utf-8
i jsessionid curl
please help!
possibly page loading has other content sets cookies , since ou rading 1 page don't them, or cookies set through javascript.
Comments
Post a Comment