I have this:
$txt = file_get_contents("http://example?a=".$text); $file = "texts/".md5($text).".txt"; file_put_contents($file, $txt, FILE_APPEND);
and everything is okay. Except when I access the file again, $file values are doubled. So I try to add if(!file_exists($file)):
$txt = file_get_contents("http://example?a=".$text); $file = "texts/".md5($text).".txt"; if(!file_exists($file)) { file_put_contents($file, $txt, FILE_APPEND); }
but that does not work, now FILE_APPEND containing only the first $txt values, not all. I hope you understand. Thanks.