SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Taiwan
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Saving output of PHP file to variable

    I've got a script i wrote that is piecing together a CSV. Part of this task is to include HTML code inside of the CSV. What i'm trying to do is save the output of a file like text_file.php to a variable like $text_file_output. I can't figure out a way to include the output of a PHP page to a variable.

    Any help is appreciated!

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    UK
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using PHP 5+?

    If so..

    PHP Code:
    $value file_get_contents("text_file.php"); // if this file is in same dir 

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Taiwan
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bfsog
    Using PHP 5+?

    If so..

    PHP Code:
    $value file_get_contents("text_file.php"); // if this file is in same dir 
    PHP 4+

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    file_get_contents also works fine on php4 .


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
  •