tags:

views:

35

answers:

2

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.

+1  A: 

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.

alex
IIRC, `file()` does what your second paragraphs suggests.
Piskvor
+1  A: 

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

Māris Kiseļovs