Possible Duplicate:
Change tag attribute value with PHP DOMDocument
How can i use PHP DOMElement class to replace the href-value of a HTML-string with a new value?
With jQuery i would have done something like this
$('a[myattr~="myval"]').attr('href','http://www.google.se');
Thought that was the simplest way to explain it.