Suport de The Movie Database

i am new to api and i am having issues with the api requests
i am creating a streaming website and i searched for every movie in the TMDB i got the movie id and i added it into the database
so when the user clicks on one of the movie a script will get the movie id that matches the movie name in mysql (i dont know if this is the right way or not)
i only have movies in my website and only request these info title name - description - poster_path - category - runtime - year - imbdrating - actors with there posters.
everything works fine but sometimes my page give me Undefined variables for my requests and when i check my request log i fond that i am request random information not related to my requests like,
200 GET /3/tv/2 - 200 GET /3/search/multi - 200 GET /3/trending/all/day 7/28/2023 12:11 PM 200 GET /3/trending/all/day 7/28/2023 12:10 PM 200 GET /3/trending/all/day 7/28/2023 12:11 PM 200 GET /3/trending/all/day 7/28/2023 12:10 PM
simply a random requests so i dont know what to do hope i get help

code text here

// Fetch movie details from TMDB using the provided function
list($movieTitle, $movieDescription, $posterPath, $releaseYear, $runtime, $genres, $imdbRating) = getMovieDetails($MovieId, $apiKey);

function getMovieDetails($MovieId, $apiKey) {
    $baseUrl = "https://api.themoviedb.org/3/movie/{$MovieId}";
    $query = http_build_query([
        'api_key' => $apiKey,
        'append_to_response' => 'credits',
    ]);

    try {
        $httpClient = new \GuzzleHttp\Client();
        $response = $httpClient->get("$baseUrl?$query");

        $data = json_decode($response->getBody(), true);

        $movieTitle = $data['title'];
        $movieDescription = $data['overview'];
        $posterPath = $data['poster_path'];
        $releaseYear = date('Y', strtotime($data['release_date']));
        $runtime = $data['runtime'];
        $genres = array_column($data['genres'], 'name');
        $imdbRating = number_format($data['vote_average'], 1);


No trobeu una pel·lícula o una sèrie? Inicieu la sessió per a crear-la.

Global

s centra la barra de cerca
p obre el menú del perfil
esc tanca una finestra oberta
? obre la finestra de dreceres de teclat

A les pàgines de materials

b torna enrere (o la superior quan sigui aplicable)
e ves a la pàgina d’edició

A les pàgines de temporades

(fletxa dreta) ves a la temporada següent
(fletxa esquerra) ves a la temporada anterior

A les pàgines d'episodis

(fletxa dreta) ves a l'episodi següent
(fletxa esquerra) ves a l'episodi anterior

A totes les pàgines d'imatges

a obre la finestra d'afegir imatges

A totes les pàgines d'edició

t obre el selector de traducció
ctrl+ s envia el formulari

A les pàgines de debat

n crea un debat nou
w canvia l'estat de visualització
p canvia públic/privat
c tanca o obre
a obre activitat
r resposta al debat
l ves a la darrera resposta
ctrl+ enter envieu el vostre missatge
(fletxa dreta) pàgina següent
(fletxa esquerra) pàgina anterior

Configuracions

Desitgeu valorar o afegir aquest element a una llista?

Inicieu la sessió