I'm trying to read an html file from my local server into a string, I'm
using the following code:
$attfile = $attachment[$i]; //create filenames
$file_name = basename ($attfile);
$lines = file($attfile); //get file into array
foreach ($lines as $line_num => $line) { //concatenate each line
$fcontent.= $line;
}
This should just load the file as an array then go through each line and add
it to the end of the $fcontent variable. It does this but on larger files
(4000+ lines of html) it stops part way through a line ver close to the end.
Basically it misses off about 10-15 lines at the end of the html file
I've increased the size of the file and it always seems to stop near the
end, but the line where it quit before is finished. So I guess it's not some
random character combination excaping it or reaching some kind of buffer
limit.
Does anyone have any ideas or know a simple script that will grab the
contents of an html file and put it into a string (not an array). I'm using
4.2.2 with no chance of upgrading so I can't use file_get_conten ts.
Thanks
Alex
using the following code:
$attfile = $attachment[$i]; //create filenames
$file_name = basename ($attfile);
$lines = file($attfile); //get file into array
foreach ($lines as $line_num => $line) { //concatenate each line
$fcontent.= $line;
}
This should just load the file as an array then go through each line and add
it to the end of the $fcontent variable. It does this but on larger files
(4000+ lines of html) it stops part way through a line ver close to the end.
Basically it misses off about 10-15 lines at the end of the html file
I've increased the size of the file and it always seems to stop near the
end, but the line where it quit before is finished. So I guess it's not some
random character combination excaping it or reaching some kind of buffer
limit.
Does anyone have any ideas or know a simple script that will grab the
contents of an html file and put it into a string (not an array). I'm using
4.2.2 with no chance of upgrading so I can't use file_get_conten ts.
Thanks
Alex
Comment