I am trying to get the source for images on some pages but there are some differences between the code of the two pages.
Page 1 Code:
<img class="thumb thumb_0" onclick="setImage(0); return false;" src="http://example.com/b1.jpg">
Page 2 Code:
<img style="width: 46px ! important; height: 46px ! important;" class="thumb thumb_0" onclick="setImage(0); return false;" src="http://example.com/image4.jpg">
Notice the difference between the 2 pages... Page 2 has a stupid style at the beginning of the img tag. Also, the "onclick" is located in a different position. The only thing I need to snag is the image location.
Here is the code that I have thus far... which only works for page 1 scenario:
preg_match_all("/<img\s*?class='thumb.*?'.*?src='(.*?)'.*?\/>/is", $hotelPage, $thumbs, PREG_PATTERN_ORDER);
Ideally, I would like to be able to keep it in one php line. How can I do an "or" in preg_replace and how can I get the regex to work for page 2 as well?
Thank you in advance!
UPDATE: The pages have other images, I am only looking for the ones that have a class that contains "thumb". I apologize for leaving out that heavy detail.