/** * Scrapes titles from imdb advanced search * * @param array $input * @return void */ public function imdbAdvanced(array $input) { ini_set('max_execution_time', 0); $url = $this->compileImdbAdvancedUrl($input); $amount = $input['howMuch']; $currentPage = 1; while ($currentPage <= $amount) { $html = $this->curl($url); //increment current page by 100 as thats how many //titles page containts $currentPage = $currentPage + 100; //change url so it starts at 100 more then previous scrape $url = preg_replace('/&start=[0-9]+/', "&start={$currentPage}", $url); $data = $this->imdbSearch->compileSearchResults($html); if (!$data) { return false; } $this->dbWriter->insertFromImdbSearch($data); } Event::Fire('Titles.Updated'); return $currentPage; }