How to get these?

Discussion in 'PHP' started by Fracisc, Oct 12, 2013.

  1. #1
    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> &nbsp; <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?
     
    Fracisc, Oct 12, 2013 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    HuggyStudios, Oct 12, 2013 IP
  3. Fracisc

    Fracisc Well-Known Member

    Messages:
    3,670
    Likes Received:
    10
    Best Answers:
    1
    Trophy Points:
    195
    #3
    It's not quite what I needed.. That site has many items on one page so it shoucl maybe forech all the matched content..
     
    Fracisc, Oct 12, 2013 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    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...
     
    PoPSiCLe, Oct 12, 2013 IP