Warum php curl nicht speichern cookie in meinem cookiefile?

Ich versuche ein cookie gespeichert werden soll, in die LOCKE cookiejar. Ich habe vereinfacht meinen code aber es funktioniert nicht.

<?php

$cookie_file = './cookies.txt';

if (! file_exists($cookie_file) || ! is_writable($cookie_file)){
    echo 'Cookie file missing or not writable.';
    exit;
}//cookie_file is writable, so this is not the issue

$ch = curl_init (html_entity_decode("http://localhost/kiala_test/setcookie.php"));
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$output = curl_exec ($ch);
echo $output;
?> 

setcookie.php

<?php 
$value = 'something from somewhere';
setcookie("TestCookie", $value);

?>

received-Kopfzeile

HTTP/1.1 200 OK Date: Thu, 10 Oct 2013 12:10:37 GMT Server:
Apache/2.4.4 (Win64) PHP/5.4.12 X-Powered-By: PHP/5.4.12 Set-Cookie:
TestCookie=etwas+aus+irgendwo Content-Length: 0 Content-Type:
text/html

also das testcookie im Kopf, aber meine cookiefile bleibt leer. Was mache ich falsch? was kann ich versuchen um in diesem Beispiel zu arbeiten? danke!

InformationsquelleAutor kasper Taeymans | 2013-10-10

Schreibe einen Kommentar