?
Solved

cURL Cookie Storage Question

Posted on 2006-07-10
4
Medium Priority
?
1,645 Views
Last Modified: 2012-05-05
I have a script using cURL to login to a web site that uses cookies to store login information and grabs several bandwidth usage images (charts).

Now, this is the setting that I have in my script that sets the cookiejar file...
   curl_setopt($ci, CURLOPT_COOKIEJAR, "/tmp/cookies.txt");

Since the login form gets submitted everytime I run the script, would it be possible to store the cookiejar in memory rather than in a file?  I'd rather store the cookies in memory than in a file.

Thanks,

Jeff
0
Comment
Question by:RWJDCom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 17073415
Not sure if you can using any of the curl options.

If it actaully is the case that curl cannot suport this, then you can use stream_wrappers and use

curl_setopt($ci, CURLOPT_COOKIEJAR, "var://cookie");

This based on the streamwrapper for var:// as defined in http://php.net/manual/en/function.stream-wrapper-register.php

-r-
0
 
LVL 14

Accepted Solution

by:
ThG earned 375 total points
ID: 17073505
Why do you care about this? If the security is an issue, just create the empty file with fopen() and chmod() it to 0600, or use the umask() http://it.php.net/umask function.

If you are worried by performances, in linux there is a ram-based memory cache before filesystem (it's a module called vfs inside linux kernel), so if you create that file and unlink() it in a few seconds, it won't even be written to your hard drive.
0
 
LVL 8

Author Comment

by:RWJDCom
ID: 17079185
I'm not really concerned about security, I just don't want to have a file for the cookies...
0
 
LVL 8

Author Comment

by:RWJDCom
ID: 17095352
I'm going to check out that memory module.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question