Skip to content

Instantly share code, notes, and snippets.

@mdwitr0
Created May 12, 2023 20:39
Show Gist options
  • Save mdwitr0/730866fa0de320194f291319d4dc4ebc to your computer and use it in GitHub Desktop.
Save mdwitr0/730866fa0de320194f291319d4dc4ebc to your computer and use it in GitHub Desktop.
<?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