Codice PHP:
[..]
$h=fopen("path_dove_salvare/lista.txt",'w+');
fwrite($h,$txt);
fclose($h); 
adesso lo sai fare..

copy->copia
fwrite->scrive file