TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-12-2008, 06:20 PM   #1 (permalink)
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
Old 06-12-2008, 07:07 PM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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.
Salathe is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:18 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design