$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "name=$id&pass=$pw");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'C:\Inetpub\vhosts\site\httpdocs\bar\cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'C:\Inetpub\vhosts\site\httpdocs\bar\cookie.txt');
$content = curl_exec ($ch);
curl_close ($ch);
When I look at the header that is recieved after executing this code I see the session ID. Login is successful, cookie.txt is empty.