View Full Version : Resolved DomDocument get content in text file

08-14-2012, 08:07 PM

I was able to get the content by ID and tag names, but I am wondering how can I just get all the contents from a text file (which doesn't have any markup)?

$doc = new DomDocument;
$doc->validateOnParse = true;
$t = ($doc->getElementById("patch"));
print $t->nodeValue;

Thanks :)

08-14-2012, 08:23 PM
foreach($lines as $line){
echo $line;

08-14-2012, 08:35 PM
Yep, or file_get_contents, or standard fopen/fread.
DOM is only useful if it has an actual document object model to process. Flat files require a flat reading technique.

08-14-2012, 11:39 PM
Haha, yeah I was probably going overboard on Dom, I just discovered it.

Thanks guys!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum