curl-and-php
RE: Curl only capture and save a part of Cookie. What should I do?
Date: Sat, 9 May 2009 06:38:31 +0800
Hi Viet,
Those missing cookies are probably set via JavaScript which cURL is unable
to parse as it's not set via HTTP headers. If you really need to capture
them, you would have to scan through the HTML code for JS code, parse the JS
code and then simulate the creation of those cookies. If you actually did
some googling, you would discover that cookies such as __utma and __utmz are
set by Google Analytics, which you probably don't need for your cURL
application.
Does that answer your question?
With regards,
Liu Shan Shui
me_at_lx.sg
"Life would be much easier if I had the source code." - Anonymous
-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of Nguyen Viet
Sent: Friday, May 08, 2009 5:41 PM
To: curl-and-php_at_cool.haxx.se
Subject: Curl only capture and save a part of Cookie. What should I do?
Hello, i am working with CURL. I did many small scripts with CURL
succesfully but the one i am working, i cannot make CURL to get right
cookie.
This is the normal cookie of that site when I use browser such as FF or IE
====
Cookie: JSESSIONID=A11C5C53CF0167B359B685241523834D;
CASTGC=TGT-497566-Yx7RLbNcouF5yNeNpQGcCEdbZN0IFOHraz01WYj4FBhErWRsfU-cas;
org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE=vi;
__utma=130111240.362387723.1241281795.1241453636.1241629556.5;
__utmz=130111240.1241281795.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none
)
====
I used the following code to get cookie as other sites I have done,
but it only captures a part of cookie like this
"JSESSIONID=A11C5C53CF0167B359B685241523834D".
I have search a lot on google.com all of this week before posting. But
i cann't find the answer for my problem. Please help me.
============
$url="https://www.somesitehere.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'Z:/www/beta/log/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'Z:/www/beta/log/cookie.txt');
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_exec($ch)
curl_close ($ch);
============
Thank you everyone.
Nice weekend
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2009-05-09