Monday 12 June 2017

How to fetch youtube video data in API using php.

https://www.youtube.com/watch?v=ABHFLHVQ123
In this URL your youtube video id is showing in red color.


<?php $data = file_get_contents("https://www.googleapis.com/youtube/v3/videos?id=YOUTUBE_VIDEO_ID&key=YOUR_YOUTUBE_APIKEY&part=snippet,contentDetails,statistics,status");  

$result = json_decode($data, true); 
 echo "<pre>"; print_r($result); 

 ?>

You can learn more about youtube data api from https://developers.google.com/youtube/v3/getting-started

No comments:

Post a Comment