Answer the question
In order to leave comments, you need to log in
How to fix or change GET request correctly for API?
Help fix GET request. Everything seems to be working fine, but I need to get information not just from a link in https://tmdb.com/ or like this https://tmdb.com/index.php?id=45782 I need to do https instead of ?id=45782 ://tmdb.com/45782 How to organize or fix this? Editing .htaccess with different methods did not help.
session_start();
// TMDB API ' . urldecode(http_build_query($params))
// $id = $_GET['id'];
$id = $_GET['id'] = '45782';
$tmdbparam = array(
'api_key' => "KEY", // Или используйте временный ключ - 167bec11ad1d2c8ced5935a645b04e1c
'language' => "ru-RU"
);
$tmdb = file_get_contents('https://api.themoviedb.org/3/tv/'.$id.'?' . urldecode(http_build_query($tmdbparam)));
$tmdb = json_decode($tmdb, true);
//TMDB API
/*else
{
die('Такой фильм не найден.');
}
header("Location: /info");
}
*/
echo '<pre>'; print_r($tmdb); echo '</pre>';
Answer the question
In order to leave comments, you need to log in
The question is closed!. just 2 lines at the beginning:
<?php
$url1 = (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) ? 'https://' : 'http://';
$url1 = $_SERVER['REQUEST_URI'];
$tmdbparam = array(
'api_key' => "167bec11ad1d2c8ced5935a645b04e1c", // Или используйте временный ключ - 167bec11ad1d2c8ced5935a645b04e1c
'language' => "ru-RU"
);
$tmdb = file_get_contents('https://api.themoviedb.org/3/tv/'.$url1.'?' . urldecode(http_build_query($tmdbparam)));
$tmdb = json_decode($tmdb, true);
echo '<pre>'; print_r($tmdb); echo '</pre>';
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question