I have a string with html code and lots of images in it. What I want to do is grab the URL of all those images. Normally, I'd just use this: preg_match_all("/<img src=\"(.*?)\"/si",$data,$matches); but some of the images aren't structured that way. For example: <img src='img.jpg'> <img src=img.jpg alt="an image"> How can I code it so it grabs the image url no matter what?
Maybe this will help you http://www.web-development-blog.com/archives/parse-html-with-preg_match_all/