hello again,
I've got a html file as string and i'm looking for the first image src. I been trying to use this script:
$imgstart = strpos($file, '<img');
$imgend = strpos($file, '>', $imgstart);
$imgtaglen = $imgend - $imgend;
$imgtag = substr($file, $imgstart, $imgtaglen);
$srcstart = strpos($imgtag, 'src=');
$srcend = strpos($imgtag, '"', $srcstart);
$srclen = $srcend - $srcstart;
$src = substr($imgtag, $srcstart, $srclen);
first it narrows down the <img> tag and the finds the src. I've tried to work out whats wrong and all I know is it's not putting anything in $imgtag, not finding the tag.
anyone see whats wrong?
thanks