예제 #1
0
 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();
 }
예제 #2
0
 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;
 }
예제 #3
0
 function __construct()
 {
     $this->merchantUrl = setMerchantUrl();
 }