extract src from img tag - html

<?php

$html = '<img src="http://domain/imagine.jpg" id="randomid" />';

if (preg_match('/<img.+?src(?: )*=(?: )*[\'"](.*?)[\'"]/si', $html, $arrRes)) {
    echo $arrRes[1]; 
}

?>

Comentarii

Postări populare de pe acest blog

Config realurl for my extension