Get YouTube video information using api in php

Follow below steps to get YouTube video information
Step 1:
Step 2:
  •  Create / Select project
  •  Create new key or Get API key
Step 3: Create a php script to get video details using YouTube video id
        Example:
        https://www.youtube.com/watch?v=ZdP0KM49IVk
        in this url video id is showing in Red color

Step 4: Add below code to your php file
<?php
$vdata = file_get_contents("https://www.googleapis.com/youtube/v3/videos?id=VIDEO_ID&key=YOUR_APIKEY&part=snippet,contentDetails,statistics,status");
$result_data = json_decode($vdata, true);
echo "<pre>";
print_r($result_data);
?>

Comments

Popular posts from this blog

Stop video playing when Bootstrap modal is closed