Scusate se insisto.. ma un occhiatina alla guida no? :master: :master:
Se usi php5 puoi usare file_put_contents, che come dice la guida è lo stesso che chiamare fopen , fwrite, fclose successivamente..
int file_put_contents ( string filename, mixed data [, int flags [, resource context]] )
Identical to calling fopen(), fwrite(), and fclose() successively.