
Exactamente eso necesito, muchas gracias
kiko's.
ufff que interesante este tema, se merece una buena estudiada. Dejaré el código completo con las recomendaciones de todos:
Código PHP:
Ver original<?php
$html = '<html><body>Test<br /><img src="myimage.jpg" title="title" alt="alt" /><img src="myimage2.jpg" title="title" alt="alt" /></body></html>';
$doc = new DOMDocument();
$doc->loadHTML($html);
$images = $sxe->xpath('//img[position() = 1]/@src');
echo $images[0]['src'];
Saludos