Thread: Scraping HTML

Page 2 of 2 First 12
  • Jump to page:
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2008
    Rep Power
    Originally Posted by ManiacDan
    Give an actual example of what you want, we can't continue to help you maybe spider a potential div which may be on a webserver somewhere.
    Ok sure,
    I would like to scrape the price ($399) of this item:

    Any idea how to do this?

  2. #17
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Rep Power
    DOM is the way but without setting validate to true. However, be sure to check the TOS for any web site you intend to scrape.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #18
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Pennsylvania, USA
    Rep Power
    regex will also work if all you need is a single field:

    php > preg_match('/itemprop="price" content="([^"]+)"/', file_get_contents(''), $f);
    php > echo $f[1];
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo