Created
May 13, 2021 00:12
-
-
Save 6ui11em/da6ca573670b9e80d3e64a0764804200 to your computer and use it in GitHub Desktop.
Youtube: Get Video Information API call PHP #youtube #php #api #video
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
$api_key = "API Key" | |
$video_id = "Video ID" | |
$url = "https://www.googleapis.com/youtube/v3/videos?id=" . $video_id . "&key=" . $api_key . "&part=snippet,contentDetails,statistics,status"; | |
$json = file_get_contents($url); | |
$getData = json_decode( $json , true); | |
foreach((array)$getData['items'] as $key => $gDat){ | |
$title = $gDat['snippet']['title']; | |
} | |
// Output title | |
echo $title; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment