Page 1 of 1
Default location for CURLOPT_COOKIEFILE file
Posted: Sun Feb 19, 2006 6:24 am
by anjanesh
Code: Select all
curl_setopt ($handle, CURLOPT_COOKIEFILE, "cook.txt");
Anyone know where does cook.txt get created ? Which is the default location for cook.txt ?
I dont want to insert an absolute path.
Thanks
Posted: Sun Feb 19, 2006 9:17 am
by feyd
search. your. computer.

Posted: Sun Feb 19, 2006 1:13 pm
by anjanesh
Ok - I've set it to a specific location and I can view it - but thats because I know the location of the file.
Code: Select all
curl_setopt ($handle, CURLOPT_COOKIEFILE, "D:/xxx/cook.txt");
curl_setopt ($handle, CURLOPT_COOKIEJAR, "D:/xxx/cook.txt");
How do I set a relative path ? This code will only work if there exists a directory D:\xxx and I got permission to write to that directory. When I upload to a linux server (possibly shared) then I wouldnt know the full path.
Posted: Sun Feb 19, 2006 3:34 pm
by yum-jelly
any path in any function call in PHP default to where the script is run from (directory). So if your running the script from C:/path/to script.php, then the cookie file will be at C:/path/cookie_file_name.extension. If you want to put it in it own directory then you could do this...
Code: Select all
$cookies = './cookies/';
curl_setopt ( $handle, CURLOPT_COOKIEFILE, $cookies . 'cookie.txt' );
Then PHP will store the cookie file in.... (as long as you have a directory called cookies in the same directory where the script is!)
C:/path/cookies/
If you just want to store where the script is then you could use...
Code: Select all
$cookies = './cookies.txt';
curl_setopt ( $handle, CURLOPT_COOKIEFILE, $cookies );
yj!
Posted: Fri Feb 24, 2006 1:00 am
by anjanesh
any path in any function call in PHP default to where the script is run from (directory). So if your running the script from C:/path/to script.php, then the cookie file will be at C:/path/cookie_file_name.extension.
It doesnt seem so.
My Apache is in
C:\Program Files\Apache Group\Apache 2\ and my htdocs is in
D:\
When not giving the absolute path, cookie.txt is getting stored in
C:\Program Files\Apache Group\Apache 2\ and not the
D:\htdocs\xxx which is where my curl script is running.