Question

How to read an HTML page line by line using php. I have to add and edit some file paths of my html page using php.

Was it helpful?

Solution

Unless you explicitly want to read a HTML file line by line, use a DOM parser.

Otherwise, if for some reason you do want to read it line by line, split the contents by newline \n (should be, you may want to normalise other newline types like \r\n) and then iterate through the resulting array.

OTHER TIPS

I can't agree more with alex. But i can recommend http://simplehtmldom.sourceforge.net/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top