Поддержка 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);


Не можете найти фильм или сериал? Войдите на сайт, чтобы добавить его.

Глобальные

s фокусироваться на панели поиска
p открыть меню профиля
esc закрыть открытое окно
? открыть окно сочетаний клавиш

На страницах медиа

b назад (или выше, если применимо)
e перейти на страницу правки

На страницах сезонов

(стрелка вправо) перейти к следующему сезону
(стрелка влево) перейти к предыдущему сезону

На страницах эпизодов

(стрелка вправо) перейти к следующему эпизоду
(стрелка влево) перейти к предыдущему эпизоду

На всех страницах изображений

a открыть окно добавления изображения

На всех страницах правки

t открыть переключатель переводов
ctrl+ s отправить форму

На страницах обсуждения

n создать новое обсуждение
w сменить статус отслеживания
p публичное/приватное
c закрыть/открыть
a открыть страницу действий
r ответить в обсуждении
l перейти к последнему ответу
ctrl+ enter отправить своё сообщение
(стрелка вправо) следующая страница
(стрелка влево) предыдущая страница

Параметры

Хотите поставить оценку или добавить в список?

Войти