MovieData::updateImdbToplist PHP Method

updateImdbToplist() public method

public updateImdbToplist ( )
    public function updateImdbToplist()
    {
        if ($_SERVER['SERVER_ADDR'] != $_SERVER["REMOTE_ADDR"]) {
            throw new Exception(L::get("MUST_BE_RUN_BY_SERVER_ERROR"), 401);
        }
        $data = file_get_contents("http://akas.imdb.com/boxoffice/rentals");
        preg_match_all("/\\/title\\/(.*?)\\//", $data, $matches);
        $array = $matches[1];
        unset($array[0]);
        $this->db->query('DELETE FROM imdbtop20');
        foreach ($array as $a) {
            $this->db->query('INSERT INTO imdbtop20(imdbid) VALUES(' . $this->db->quote($a) . ')');
            $this->getDataByImdbId($a);
        }
    }

Usage Example

Esempio n. 1
0
         $cleanup->run();
         httpResponse();
         break;
     case validateRoute('GET', 'run-leechbonus'):
         $leechbonus = new Leechbonus($db);
         $leechbonus->run();
         httpResponse();
         break;
     case validateRoute('GET', 'fetch-tvdata'):
         $tvData = new TvData($db);
         $tvData->run();
         httpResponse();
         break;
     case validateRoute('GET', 'fetch-moviedata'):
         $movieData = new MovieData($db);
         $movieData->updateImdbToplist();
         httpResponse();
         break;
     case validateRoute('GET', 'run-statistics'):
         $statistics = new Statistics($db);
         $statistics->run();
         httpResponse();
         break;
     case validateRoute('GET', 'run-bonus'):
         $log = new Logs($db);
         $bonus = new Bonus($db, $user, $log);
         $bonus->run();
         httpResponse();
         break;
 }
 /* Login check before the following routes */