Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/MicrodataPhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,21 @@ public function __construct($config) {
$dom->registerNodeClass('DOMElement', 'linclark\MicrodataPHP\MicrodataPhpDOMElement');
$dom->preserveWhiteSpace = false;

$errors = libxml_use_internal_errors(true);

// Prepare the DOM using either the URL or HTML string.
if (isset($config['url'])) {
@$dom->loadHTMLFile($config['url']);
$dom->loadHTMLFile($config['url']);
}
else if (isset($config['html'])) {
@$dom->loadHTML($config['html']);
$dom->loadHTML($config['html']);
}
else {
throw new \InvalidArgumentException("Either a URL or an HTML string must be passed into the constructor.");
}

libxml_use_internal_errors($errors);

$this->dom = $dom;
}

Expand Down