I am using CURL to connect to a mail API service. I want to save the location of the login cookie to my own directory but it seems CURL ignores my OPT parameters and the cookie.txt file is being saved in the root of my Apache directory.
I have:
$urlString = $urlStringS."/api/login1?name=$username&cleartext=$password" ;
$ch = curl_init($urlString) ;
curl_setopt($ch, CURLOPT_COOKIEJAR, 'http://localhost:8080/IMS3/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'http://localhost:8080/IMS3/cookies.txt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CAINFO, dirname(__FILE__)."/cacert.pem");
$result = curl_exec($ch) ;
$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch) ;
I have also tried various path forms for the cookies.txt file such as /cookies.txt etc but to no avail.
How do I get control of where cookies.txt is saved?