SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast pff's Avatar
    Join Date
    Dec 2000
    Location
    Google PageRank: 6
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Saving the output to a .txt file

    I'm very new to PHP. How can I save the output of a PHP script to a .txt file everytime it's executed?

    Thanks
    pff | I am not what I am

    'Does he exist in the same way as I exist?'
    'You do not exist Winston,' said O'Brien.

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The output? What do you mean?

    You can do an fopen() and fputs()...

  3. #3
    SitePoint Enthusiast pff's Avatar
    Join Date
    Dec 2000
    Location
    Google PageRank: 6
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to capture all the echo()s and print()s and save that output to a .txt
    pff | I am not what I am

    'Does he exist in the same way as I exist?'
    'You do not exist Winston,' said O'Brien.

  4. #4
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure... Here's what I'd do.

    function iecho($str) { echo "$str";
    $outputtofileatend . $str; }

    function iprint($str) { print "$str";
    $outputtofileatend . $str; }

    And then just use those instead of echo and print... But I'm probably missing something.

  5. #5
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could also use PHP's output buffering. I'm not quite sure how you would use it, but these pages will give you a start.

  6. #6
    SitePoint Enthusiast pff's Avatar
    Join Date
    Dec 2000
    Location
    Google PageRank: 6
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help! I'd really appreciate it if someone has a specific tutorial about this topic.
    pff | I am not what I am

    'Does he exist in the same way as I exist?'
    'You do not exist Winston,' said O'Brien.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •