October 4th, 2012, 11:29 AM
Originally Posted by ManiacDan
I would like to scrape the price ($399) of this item:
Any idea how to do this?
October 4th, 2012, 11:41 AM
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.
October 4th, 2012, 12:25 PM
regex will also work if all you need is a single field:
php > preg_match('/itemprop="price" content="([^"]+)"/', file_get_contents('http://www.samedaymusic.com/product--SEAS6'), $f);
php > echo $f;
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.