body(); $data = json_decode(json_encode(simplexml_load_string($response)), true); $articles = $data["channel"]["item"]; $articlesitems = []; //Looping through the articles and scraping and while scraping it creates a new instance of the scraper. foreach ($articles as $article) { $articlesitems[] = (new ThiladhunScraper)->extract($article["link"], $articles["pubDate"]); } return $articlesitems; } }