$str = "html code here and img tag";
preg_match_all('~<img ([^>]+)>~i', $str, $matches);
$images = array();
foreach ($matches[1] as $str) {
preg_match_all('~([a-z]([a-z0-9]*)?)=("|\')(.*?)("|\')~is', $str, $pairs);
}
I can't get SRC from IMG, how to ideas ?
I would recommend you consider using simplehtmldom instead of parsing out your img src tags with regular expressions.
$html = file_get_html('...html...');
// Find all images & echo src
foreach($html->find('img') as $element)
echo $element->src . '<br>';
You can use an XML parser in PHP like Simple HTML Dom, or a regex for something like this should also work.
/src="([^"]*)"/i