php - replace href from DOMDocument from new href -


i looking change src of

$doc = new domdocument(); $doc->loadhtml($img_tag); $tags = $doc->getelementsbytagname('link'); foreach ($tags $tag) {     $old_src = $tag->getattribute('href');     $new_src_url = $sintax; //'website.com/assets/'.$old_src;     $new_src_url = str_replace ( "to_freplacer" , $old_src , $new_src_url );     if ($old_src) {         //  echo $old_src . "<br>";     }     $tag->setattribute('href', $new_src_url); } return $doc->savehtml(); 

what doing wrong? thanks


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -