function getProductDetail($merchant) { $this->merchantName = $merchant; $this->LoadMerchantScraper($this->merchantName); //Controller $this->merchantUrl = setMerchantUrl(); //merchantName_scraper.php (ex. nordstrom_scraper.php, zappos_scraper.php) $this->initialMySQLDatabase(); $next = true; do { $productUrls = $this->selectProductUrlsFromDatabase(); //SelectProductUrls Trait if (count($productUrls) != 0) { $result = $this->getContentFromWebPage($productUrls); //GetContentFromWebPage Trait $result = $this->scrapeProductDetail($result); //ScrapeProductDetial Trait $this->updateDatabase($result); //UpdateDatabase Trait } else { $next = false; } } while ($next); $this->printEndProcess(); }
function set($pageinfo, $currentPage) { $url = $pageinfo['catUrl']; $urlFormat = $pageinfo['urlFormat']; if ($currentPage != 1) { $num = $currentPage - 1; $url = setMerchantUrl() . str_replace('p=1', 'p=' . $num, $urlFormat); } return $url; }
function __construct() { $this->merchantUrl = setMerchantUrl(); }