I want to transform a webpage into leet (1337) speak with XPath and PHP.
It can be done with only PHP but then the HTML nodes are also replaced with leet speak.
Example ($html is the webpage):
$find = array("a","b","c","d","e","f","g","h","i","j"."k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
$repl = array("4","b","c","d","3","f","g","h","1","j","k","1","m","n","0","p","9","r","5","7","u","v","w","x","y","2");
$html = str_replace($find, $repl, $html);
That replaces also the HTML nodes.
Can this be done with XPath and PHP with the XPath selector text()? Example ($html is the webpage):
$dom = new DOMDocument();
$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$xpath->query('//text()');
\\HERE THE REPLACING IN XPATH