WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently creating a plugin with cURL and I need a place that will work for most WordPress servers (Unix or Windows) to store my cookie file. Anyone have a suggestion or best practices? I've been googling for a while now and I think I found something about wp_temp_dir, but googling that keyword gives me only a thousand and one results about solving some install error.

share|improve this question

migrated from stackoverflow.com Mar 21 '11 at 6:55

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

Transients seem to be appropriate storage. Just note that if you will generate a lot of this and they will be disposable then you will need to cleanup old transients.

As for your cURL/filename issue - it is bad practice to use cURL directly in WordPress. WP provides HTTP API that abstracts remote requests.

Unfortunately it is bit poorly documented. As far as I understand you pass cookies in arguments array with cookies key to its functions.

share|improve this answer
Got everything to work and recoded everything to use the WordPress HTTP API. This page really helped by the way, planetozh.com/blog/2009/08/… It's a little dated but the info still applies to the new HTTP API on the codex. – Thirlan Mar 23 '11 at 4:14

You could store cookies in transients. That way, its absctracted enough from the actual storage location that it should work across environments. Transients are stored in the wp_options table of the database by default, but can be memcached by plugins.

share|improve this answer
I don't know if this works : ( the php cURL code requires that a filename be passed in. curl_setopt($session, CURLOPT_COOKIEFILE, $this->getCookieFile()); – Thirlan Mar 21 '11 at 1:32
How do I move this question by the way? Or do I just have to repost it? – Thirlan Mar 21 '11 at 1:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.