/** * Display a listing of the resource. * * @return Response */ public function index() { // Load Scrapers if don't exist $scraper = Scraper::find(1); if (!$scraper) { $scraper = new Scraper(); $scraper->slug = 'neas-portal'; $scraper->status = 0; $scraper->save(); } $scrapers = Scraper::with('scrapes')->get(); return $scrapers; }
function __construct() { $this->scraper = Scraper::find(1); $this->scrape = new Scrape(); $this->scrape->scraper()->associate($this->scraper); $this->scrape->file_directory = 'scrapes'; $this->scrape->file_name = 'neas_portal'; $this->client = new \Goutte\Client(); $this->client->getClient()->setDefaultOption('config/curl/' . CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); $this->client->getClient()->setDefaultOption('config/curl/' . CURLOPT_TIMEOUT, 0); $this->client->getClient()->setDefaultOption('config/curl/' . CURLOPT_TIMEOUT_MS, 0); $this->client->getClient()->setDefaultOption('config/curl/' . CURLOPT_CONNECTTIMEOUT, 0); $this->client->getClient()->setDefaultOption('config/curl/' . CURLOPT_RETURNTRANSFER, true); $this->neas_list_url = 'http://neas.environment.gov.za/portal/ApplicationsPerEAP_Report.aspx'; $this->neas_eia_url = 'http://neas.environment.gov.za/portal/dNeasStandard_ApplicationHistory.aspx'; }