Exemple #1
0
 public function testCanFindListString()
 {
     $testString = '<div><ul class="productLister "><li>item 1</li><li>item 2</li></ul></div>';
     $testOutcome = '<li>item 1</li><li>item 2</li>';
     $masterScraper = new MasterScraper();
     $this->assertEquals($testOutcome, $masterScraper->getProductListString($testString));
 }
Exemple #2
0
<?php

include __DIR__ . "\\..\\autoload.php";
include __DIR__ . "\\..\\vendor\\autoload.php";
use src\Scraper\Model\MasterScraper;
$url = 'http://www.sainsburys.co.uk/webapp/wcs/stores/servlet/CategoryDisplay?listView=true&orderBy=FAVOURITES_FIRST&parent_category_rn=12518&top_category=12518&langId=44&beginIndex=0&pageSize=20&catalogId=10137&searchTerm=&categoryId=185749&listId=&storeId=10151&promotionId=#langId=44&storeId=10151&catalogId=10137&categoryId=185749&parent_category_rn=12518&top_category=12518&pageSize=20&orderBy=FAVOURITES_FIRST&searchTerm=&beginIndex=0&hideFilters=true';
$masterScraper = new MasterScraper($url);
$productData = $masterScraper->scrape();
echo json_encode($productData);