Jump to content

Problem with DOM


kukipei

Recommended Posts

Hi to all!

 

I am using this code:

header('Content-type: text/plain');
$doc = new DOMDocument();    	

	if (!$doc->loadHTML("gfd"))
	{
		echo "ERROR LOADING HTML STRING";
		exit();
	}
	$output = $doc->saveHTML();
	echo $output;

 

and here is output:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>gfd</p></body></html>

 

Is it possible to get for output only this:

gfd

 

I do not need this additional lines:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>

and

</p></body></html>

 

How can I achieve this?

Best Regards

Link to comment
https://forums.phpfreaks.com/topic/117813-problem-with-dom/
Share on other sites

Represents an entire HTML or XML document; serves as the root of the document tree

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>

All of the tags above are mandated by W3C specs.

Of course the DOCTYPE may change.

Link to comment
https://forums.phpfreaks.com/topic/117813-problem-with-dom/#findComment-605981
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.