Im trying to echo string from a file that I read from on the server.
So far I get the file open an reads it and seems to print line by line BUT my problem is the file that it reads is a text file with another websites code in it.
Looks almost like a basic website...ex:
<html> <title>Fart</title> <head> </head> <body> </body> </html>
and all the stuff inside etc etc.
So you can already see the problem here. Its going to print out an actual website titled Fart.
That's exactly what I don't want in this specific project.I want to echo the code lines one by one as it pulls it from the text file WITH PHP obviously.
So when I open my file it will be EXACTLY as it stands in the file and not HTML interpreted.
Now I have tried placing " " around every single string but it looks horrible and doesn't work anyway.
I have also tried breaking out with // and only 1 / as well, didn't work.
I have even tried <code></code> doesnt work anyway .
Here's the code for reading out of the file and echo it.
<?php
$x=0;
$handle = @fopen('code.txt', "r");
echo "'";
if ($handle) {
while (!feof($handle)) {
$x = $x+1;
$lines[$x] = fgets($handle, 4096);
//echo $lines[3],"\n";
echo '" ',$lines[$x],' "' ,"</br>";
}
fclose($handle);
}
?>
Thanks
This post has been edited by Dormilich: 17 March 2013 - 01:15 PM

New Topic/Question
Reply



MultiQuote



|