/** * Crawl the Ripe Fruits page and scrape the products * * @return string */ public function scrape() { $request = $this->httpClient->request(); $crawler = new Crawler($request['body']); // Loop through the products $crawler->filter('ul.productLister .product .productInner')->each(function (Crawler $node, $i) { $this->buildProduct($node, $i); }); // Format the total to have 2 decimals $this->products['total'] = number_format($this->products['total'], 2); return $this->toJSON(); }