<?php $html = <<<EOD <html> <head> <link rel="stylesheet" href="http://[::1]:5173/app.css"/> <script src="https://[::1]:5173/app.js"></script> </head> <body> <a href="http://[::1]" data-custom="http://[::1]">anchor</a> <form action="http://[::1]"></form> <blockquote cite="http://[::1]"></blockquote> </body> </html> EOD; $document = new DOMDocument(); $document->loadHTML($html, LIBXML_HTML_NOIMPLIED); print $document->saveHTML(); print "\n"; // internally it is represented correctly $link = $document->getElementsByTagName('link')->item(0)->getAttribute('href'); var_dump($link); print "\n"; // Dom\HTMLDocument works fine $htmldocument = Dom\HTMLDocument::createFromString($html, LIBXML_HTML_NOIMPLIED); print $htmldocument->saveHTML();
You have javascript disabled. You will not be able to edit any code.