From the little research I've done, I thought that setting the CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE options as I have done would make the current session cookie available in the redirected page. But it is not, and nothing appears to be written to curl_cookies.txt. The file has permissions 666 so that it can be read and written to. It is under the home directory so it cannot be browsed to. Did I not specify the path correctly?
Can anyone help?
- Code: Select all
function Redirect($url, $postinfo)
{
$curlh = curl_init();
curl_setopt($curlh, CURLOPT_URL, $url);
if(isset($postinfo))
{
curl_setopt($curlh, CURLOPT_POST, 1);
curl_setopt($curlh, CURLOPT_POSTFIELDS, $postinfo);
}
curl_setopt($curlh, CURLOPT_COOKIEJAR, "/curl_cookies/curl_cookies.txt");
curl_setopt($curlh, CURLOPT_COOKIEFILE, "/curl_cookies/curl_cookies.txt");
curl_exec($curlh);
curl_close($curlh);
return 1;
}
