I use file_get_contents to get file http://mydomain.com/test.html inside the html file, I need to get the text between <div id="testing"></div> <div id="testing"> I need to find out whatever the content here. /sldfksf /n likllsdf </div> whats the best way to do it? all i can think about is to read line by line,but I got I have alot pages to process, that will take forever, is there a better way to do it.
What I would do is this, assuming that you only have "<div id="testing"></div>" once in your html file... assuming your file is read into the variable $htmlcontents $pos1=strpos($htmlcontents, "<div id=\"testing\">"); $pos1=$pos1+18; $pos2=strpos($htmlcontents, "</div>", $pos1); $testingvalue=substr($htmlcontents, $pos1, $pos2-$pos1); Code (markup): I can't say if that's the best way to do it, but that's what I would do.