A PHP Script for scrapping website with Object Oriented Way, The main Technology used is CURL. the example below shows step by step instructions to scrape Amazon
- include the class
require_once('class.scrape.php');
- Create a Instance of Scrape class by providing the url you want to scrape
$amazon = new Scrape('http://www.amazon.in/gp/product/B00OZN0FI0/');
- Getting Product Title
$amazon->title = $amazon->xPathObj->query('//h1')->item(0)->nodeValue;
The methods function and defination is commented in class
- Getting Product Price
$amazon->price = $amazon->xPathObj->query('//span[@id="priceblock_saleprice"]')->item(0)->nodeValue;