Putting text in a file in wordpress
I just finished up redoing a plug-in which allows for storage of PayPal IPN data into a database table. I even have the plug-in mailing out IPN data correctly, no errors or warnings etc. Program is functional in all ways, except for the “backup” (or debug) text file I created to hang in the plug-in directory folder. Although the IPN data does file in the log file, the action always throws an warning error – [10-May-2010 18:53:54] PHP Warning: Cannot modify header information – headers already sent by (output started at … /logitfile.txt:4) in etc, etc.
I had to move along and get this plug-in working for the client but this warning stuff nags on me.
The error message occurs for every single insertion to the file. There are no blank spaces or lines in the php page(s) or the wp-config.php. I’ve gone thru various xxx_encode() concepts, header content-type concepts (as it works with the email) and all the possible combinations of fopen/fclose and file_put_contents I can imagine. The days spent searching and experimenting on this warning have been fruitless. Does anybody have the “definitive” work around to write to a text file in WordPress (not as a function call) like standard PHP 4 or 5 calls for?
- The topic ‘Putting text in a file in wordpress’ is closed to new replies.