I have the following image src in my page
<img src="http://path_to_image/platinum/getmedia?ID=97629047310&LOOT=50041223935" width="290" height="193">
and this code in my php
    $dom = new DOMDocument();
    $dom->loadHTML($page);
    foreach ($dom->getElementsByTagName('img') as $img) {
        $src = $img->attributes->getNamedItem('src')->nodeValue;
        if ($src{0} === '/') {
            $src = 'http://' . $server . $src;
        }
        $img->attributes->getNamedItem('src')->nodeValue = $src;
    }
    $page = $dom->saveHTML();
If I view $page after saveHTML the img src is
<img src="http://path_to_image/platinum/getmedia?ID=97629047310" width="290" height="193">