From d1fe4536cc039450b540104e382db0d01d5cf886 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Fri, 19 Jun 2020 02:16:51 +0100 Subject: Initial commit --- app/Console/Commands/ScrapeUrl.php | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 app/Console/Commands/ScrapeUrl.php (limited to 'app/Console/Commands/ScrapeUrl.php') diff --git a/app/Console/Commands/ScrapeUrl.php b/app/Console/Commands/ScrapeUrl.php new file mode 100644 index 0000000..c02080e --- /dev/null +++ b/app/Console/Commands/ScrapeUrl.php @@ -0,0 +1,61 @@ +client = new Client(); + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + $url = $this->argument('url'); + + if ($url != 'https://www.sixnationsrugby.com/fixtures/') { + $this->error('Url not supported'); + return; + } + + $crawler = $this->client->request('GET', $this->argument('url')); + + $crawler->filter('div.fixtures__top-tier')->each( + function ($node) { + print $node->text()."\n"; + } + ); + + + } +} -- cgit v1.2.3