<?php
class parsedictionary {
public function _process() {
$webpage="http://www.oppapers.com/essays/Computerized-World/160871?read_essay";
$doc=new DOMDocument();
$doc->loadHTML($webpage);
echo $doc;
}
}
$obj=new parsedictionary();
$obj->_process();
?>
I can’t get the content of that page.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<body>
<p>http://www.oppapers.com/essays/Computerized-World/160871?read_essay</p>
</body>
</html>
But i need to get the content of that page.
The
DOMDocumentclass is obviously not a string; you can iterate it, perform operations on it, but it can’t just be echoed. Check the documentation to see what you can do with it: http://www.php.net/domdocumentTo get the page contents, you can either use
file_get_contentsor doecho $doc->saveHTML()Edit: Didn’t realize you had another problem in your code; you can just use this instead: