client = new Client(); } /** * Return the latest articles from avas * * @return array */ public function get(): array { $crawler = $this->client->request('GET', "https://miadhu.mv"); $feeds = []; $dates = []; // scrape the dates for the articles $crawler->filter('.middle div[class*="col-md-3 col-6 news-block"] em')->each(function ($node) use (&$dates) { $dates[] = $node->text(); }); $crawler->filter('.middle div[class*="col-md-3 col-6 news-block"] h2 a')->each(function ($node, $i) use (&$feeds, $dates) { $feeds[] = [ "title" => $node->text(), "link" => $node->attr('href'), "date" => $dates[$i] ]; }); return $feeds; } }