4 require_once __DIR__ . '/../src/init.php';
6 $cc = new \Console_CommandLine();
7 $cc->description = 'phinde URL crawler';
8 $cc->version = '0.0.1';
13 'long_name' => '--show-links',
14 'description' => 'Only show which URLs were found',
15 'action' => 'StoreTrue',
22 'description' => 'URL to crawl',
28 } catch (\Exception $e) {
29 $cc->displayError($e->getMessage());
32 $url = $res->args['url'];
33 $url = Helper::addSchema($url);
34 if (!Helper::isUrlAllowed($url)) {
35 echo "Domain is not allowed; not crawling\n";
40 $crawler = new Crawler();
41 $crawler->setShowLinksOnly($res->options['showLinksOnly']);
42 $crawler->crawl($url);
43 } catch (\Exception $e) {
44 echo $e->getMessage() . "\n";