View Single Post
Old 06-12-2008, 06:20 PM   #1 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Bug Saving ALL the cookie data using cURL

I'm trying to login to a website, which I can do just fine. However, using cURL, the only information it saves in the cookie stored locally is the session ID, even though when I browse the website normally the cookie is filled with much more data.

The cookie data is partitioned using semi-colons, which indicates that they are separate cookies. I want to save all the cookies the website sends me, not just the session ID.

Set cookie function:

php Code:
public function setCookie($szCookieFilename)
{
    $this->m_aOptions['CURLOPT_COOKIEFILE'] = $szCookieFilename;
    $this->m_aOptions['CURLOPT_COOKIEJAR'] = $szCookieFilename;
    return $this;
}

Cookie file generated by cURL:

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

www.example.com	FALSE	/	FALSE	1213898159	SRSESSIONID	4ec166d4-97cc-45fb-9812-878f6344e0f8
Cookie data when browsing via Firefox:

Code:
Cookie: SRSESSIONID=9b93d992-4d7b-426b-bf9a-4d921299a82d; __gads=ID=394ee2ee9acde54b:T=1213191720:S=ALNI_MaFX1CrRehZjdV7AR0543kA9_zwzA; __utma=108050432.3221355199987115500.1213191707.1213271700.1213277210.6; __utmz=108050432.1213191708.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); __utmv=108050432.loggedInUser; __qca=1210101780-2379164-5399270; __utmc=108050432
How do I get cURL to save all the cookies that are received?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote