Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

cURL Cookie Storage Question

Posted on 2006-07-10
4
Medium Priority
?
1,651 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

604 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