-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
33 lines (25 loc) · 1.09 KB
/
example.php
File metadata and controls
33 lines (25 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Example of how to run this particular script: php test.php 100 200 https://www.emag.ro/televizoare/c
*/
require 'simple_html_dom.php';
require 'EmagCrawler.php';
$emagCrawler = new EmagCrawler();
$minLimit = 100;
$maxLimit = 200;
$link = 'https://www.emag.ro/laptopuri-accesorii/c';
$maxPageNumber = $emagCrawler->getPages($link);
$priceList = $emagCrawler -> getPrices($link, $maxPageNumber);
$linkList = $emagCrawler -> getLinks($link, $maxPageNumber);
$emagCrawler -> findPricesBetween($minLimit,$maxLimit,$priceList, $linkList, 'test.txt');
/**
* Example of how to search for items in that price range in ALL of the categories
*/
// $categories = $emagCrawler->getCategories();
// foreach ($categories as $categoryLink) {
// echo 'Checking Link ' . $categoryLink . PHP_EOL;
// $maxPageNumber = $emagCrawler->getPages($categoryLink);
// $priceList = $emagCrawler -> getPrices($categoryLink, $maxPageNumber);
// $linkList = $emagCrawler -> getLinks($categoryLink, $maxPageNumber);
// $emagCrawler -> findPricesBetween(100,200,$priceList, $linkList, 'test.txt');
// }