regex ile alanları belirtip çekerseniz sonra dosya fonksiyonları (fopen, fwrite, fclose) ile text e yazdırabilirsiniz.