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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -