I have a site with the following content: <a id="product_74115" href="http://www.site.com/randomurlhere"></a> </li> <li> <div style="background-image: url('/upload/2013/10/thumbs/randomnumbersnaddotshere.jpg');" id="img_product_74129"></div> <h3>Product name</h3> <span class="original-price"> 33 USD</span> <span class="price">33 USD </span> HTML: I am trying to use preg_match to get the following parts: - the url (http://www.site.com/randomurlhere) - the image (/upload/2013/10/thumbs/randomnumbersnaddotshere.jpg) - the H3 tag (Product name) Any suggestions one how I could do that?
You could write your own regular expressions (2nd answer) : http://stackoverflow.com/questions/5829032/how-to-find-content-using-php-regular-expression Or you could use this handy tool: http://simplehtmldom.sourceforge.net/ Hope it helps
It's not quite what I needed.. That site has many items on one page so it shoucl maybe forech all the matched content..
Wouldn't simple looped javascript matching tags / id's etc. do this easier than PHP? Depends maybe on what you wanna do with the data, but still...