These films come from The Movie Database (TMDB). Here is the real PHP I wrote to fetch and filter them.
public function __construct() { $this->apiUrl = config('tmdb.api_url'); $this->apiToken = config('tmdb.api_token'); }
private function fetchMovies($page = 1, $excludedWords = []) { $response = Http::withToken($this->apiToken) ->get("{$this->apiUrl}/discover/movie", [ 'language' => 'en-US', 'page' => $page, 'with_genres' => '10751' ]); $movies = $response->json(); // Filter out movies containing any of the excluded words $filtered = array_filter($movies['results'] ?? [], function ($movie) use ($excludedWords) { $title = strtolower($movie['title'] ?? $movie['name'] ?? ''); foreach ($excludedWords as $word) { if (strpos($title, strtolower($word)) !== false) { return false; } } return true; }); // Pagination logic $moviesPerPage = 8; $totalMovies = count($filtered); $startIndex = ($page - 1) * $moviesPerPage; return array_slice($filtered, $startIndex, $moviesPerPage); }
private function fetchChristianMovies($page = 1) { $response = Http::withToken($this->apiToken) ->get("{$this->apiUrl}/list/8938", [ 'language' => 'en-US', 'page' => $page ]); return $response->json(); }
private function fetchRecommendations($id) { $response = Http::withToken($this->apiToken) ->get("{$this->apiUrl}/movie/{$id}/recommendations"); return $response->json(); }
Rating: 7.835
Tired of scaring humans every October 31 with the same old bag of tricks, Jack Skellington, the spin...
Rating: 7.357
After a migrating duck family alights on their pond with thrilling tales of far-flung places, the Ma...
Rating: 5.359
During a rainy day, and while their mother is out, Conrad and Sally, and their pet fish, are visited...
Rating: 7.559
As Stitch, a runaway genetic experiment from a faraway planet, wreaks havoc on the Hawaiian Islands,...