I have the code below:
$html = '<!doctype html><html><head><meta charset="utf-8"></head><body><p>Hello <a href="https://www.example.com?<%= email%>">world</a></p></body></html>';
$doc = new \DOMDocument();
$doc->loadHTML($html);
print_r($doc->saveHTML());
It prints:
<!DOCTYPE html>
<html><head><meta charset="utf-8"></head><body><p>Hello <a href="https://www.example.com?<%=%20email%>">world</a></p></body></html>
But I need to keep the URL as it is in the href attribute: https://www.example.com?<%= email%> How to prevent the loadHTML to convert it to https://www.example.com?<%=%20email%> ?
thanks