WordPress.org

Ready to get started?Download WordPress

Forums

Putting text in a file in wordpress (3 posts)

  1. yattahey
    Member
    Posted 4 years ago #

    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?

  2. yattahey
    Member
    Posted 4 years ago #

    Guess this remains a mystery of the ages.

    So the ongoing question will be:

    What has happened in the wordpress code that precludes the standard php 5 treatment for this matter?

  3. yattahey
    Member
    Posted 4 years ago #

    Have a somewhat type of conclusion to this. There can not be any referencing to any other part of the blog directory - the log file must go into the same directory as the plugin. End of Line.

Topic Closed

This topic has been closed to new replies.

About this Topic