#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    usa
    Posts
    39
    Rep Power
    14
    Does any one know how to execute certain commands from a text file (like I have <img src> etc) and showing the data into a php file. I can do this with cgi, but don't know how to do with php.
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,640
    Rep Power
    4476
    include("your_file.txt")
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    usa
    Posts
    39
    Rep Power
    14
    SepodatiCreations:

    Thanks for you reply. But all i see is the content of the txt file on the browser. What i would like to see is execting the code in the text file and then displayig in the php file. I hope u can help me out.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    canterbury
    Posts
    3
    Rep Power
    0
    try renaming the text file .php or .html depending on what you need done then use the include command.
    however if this is not an option i believe you can edit a .htaccess file to tell it to process all .txt file as if they were PHP, but that i don't know how to do.

    easiest option: rename the file
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Try this :

    Contain of sample.txt :
    --------------------------------------------
    <img src="try.gif">
    <a href="hello.htm">Hello</a>
    --------------------------------------------

    PHP script :
    --------------------------------------------
    $finput=file("sample.txt");
    for ($i=0;$i<count($finput);$i++) {
    echo (stripslashes($finput));
    }
    --------------------------------------------

    good luck !

Similar Threads

  1. only showing one file in readdir
    By thindery in forum PHP Development
    Replies: 1
    Last Post: February 7th, 2004, 04:47 PM

IMN logo majestic logo threadwatch logo seochat tools logo