TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Saving ALL the cookie data using cURL (http://www.talkphp.com/advanced-php-programming/2951-saving-all-cookie-data-using-curl.html)

Wildhoney 06-12-2008 06:20 PM

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?

Salathe 06-12-2008 07:07 PM

I think the extra cookies might be set by Google software (Adsense, Analytics, etc.) via JS which would be why they're not being sent/received by cURL.


All times are GMT. The time now is 07:46 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0