Solved

cURL Cookie Storage Question

Posted on 2006-07-10
4
1,639 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 125 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
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 …

688 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