Guest User

Movie Scraper/Picker

a guest
Jul 15th, 2012
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. $movies = json_decode(file_get_contents('movies.json'));
  4. $movie = floor(rand() % count($movies));
  5. echo $movies[$movie];
  6.  
  7. /* for ($i = 0; $i < 5; $i++) {
  8.     $file = file_get_contents('http://tccl.bibliocommons.com/search?formats=BLURAY&page=' . ($i + 1) . '&q=movies&search_category=keyword&status=CE&t=catalogue&title=Movies&view=small&display_quantity=100');
  9.     preg_match_all('/\<span class=\"title\"\>(.*?)\<\/span\>/is', $file, $matches);
  10.     print_r($matches);
  11.     for ($j = 0; $j < count($matches[0]); $j++) {
  12.         preg_match('/title=\"(.*?)\(Blu-ray Disc\)\"/is', $matches[1][$j], $match);
  13.         $movies[] = $match[1];
  14.     }
  15. }
  16.  
  17. echo json_encode($movies); */
  18.  
  19. /*
  20. 1. Seven Years in Tibet
  21. 2. Star Trek - The Motion Picture
  22. 3. The Silence of the Lambs
  23. 4. Superman Returns
  24. */
Add Comment
Please, Sign In to add comment