\n"); } else { require __DIR__.'/'.$argv[1]; } $client = new Client(); $scraper = new Scraper(); // Configure object $scraper->allowedMimetypes = $allowedMimetypes; $scraper->link_rules = $link_rules; $scraper->scrape($start_urls, 0); // Download documents foreach ($scraper->results as $url => $scraped_obj) { if ($scraped_obj['is-downloadable']) { $client->request('GET', $url); print '[*] Downloading '.$scraped_obj['filename']."\n"; file_put_contents( $download_dir.'/'.$scraped_obj['filename'], $client->getResponse()->getContent() ); } }