Created
May 12, 2023 20:39
-
-
Save mdwitr0/730866fa0de320194f291319d4dc4ebc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_movie_by_id($id) { | |
$url = 'https://api.kinopoisk.dev/v1/movie/' . $id; | |
$headers = ["X-API-KEY: Your token ..."]; | |
$options = array( | |
'http' => array( | |
'header' => $headers, | |
'method' => 'GET' | |
), | |
); | |
$context = stream_context_create($options); | |
$response = file_get_contents($url, false, $context); | |
$movie = json_decode($response, true); | |
return $movie; | |
} | |
$movieId = 666; // Поменяйте на ID фильма, который вам нужен | |
$movie = get_movie_by_id($movieId); | |
print_r($movie); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment