reading an html file into a string
From: Alex Hopson (alex*under_score*hopson_at_hotmail.com)
Date: 11/30/04
- Next message: Peter: "Re: is there a quick way to remove non numeric chars"
- Previous message: Patrick: "encrypting cc in db"
- Next in thread: Hilarion: "Re: reading an html file into a string"
- Reply: Hilarion: "Re: reading an html file into a string"
- Reply: Pedro Graca: "Re: reading an html file into a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Nov 2004 17:45:37 -0000
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_contents.
Thanks
Alex
- Next message: Peter: "Re: is there a quick way to remove non numeric chars"
- Previous message: Patrick: "encrypting cc in db"
- Next in thread: Hilarion: "Re: reading an html file into a string"
- Reply: Hilarion: "Re: reading an html file into a string"
- Reply: Pedro Graca: "Re: reading an html file into a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|