@ginerjm
Lol!
It is working now:
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
//Sitemap Protocol: https://www.sitemaps.org/protocol.html
// Initiate ability to manipulate the DOM and load that baby up
$doc = new DOMDocument();
// Because we are actually manipulating the DOM, DOMDocument will add complete <html><body> tags we need to strip out
//$message = str_replace(array('<body>', '</body>'), '', $doc->saveHTML($doc->getElementsByTagName('body')->item(0)));
$message = file_get_contents('https://www.daniweb.com/programming/web-development/threads/538868/simplehtmldom-failing#post2288453');
libxml_use_internal_errors(true);
$doc->loadHTML($message, LIBXML_NOENT|LIBXML_COMPACT);
libxml_clear_errors();
// Fetch all <a> tags
$links = $doc->getElementsByTagName('a');
// If <a> tags exist ...
if ($links->length > 0)
{
// For each <a> tag ...
foreach ($links AS $link)
{
$link->setAttribute('class', 'link-style');
}
}
$message = str_replace(array('<body>', '</body>'), '', $doc->saveHTML($doc->getElementsByTagName('body')->item(0)));
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.