Tuesday 11 July 2017

Get Youtube Video Total Views, comments,like.unlike,favourate [PHP and json]

 <?php 
$video_ID = "D8Mlj39Mpyo";
$jsonURL = file_get_contents("https://www.googleapis.com/youtube/v3/videos?id={$video_ID}&key=YOUR_KEY_HERE&part=statistics");
$json = json_decode($jsonURL);
$views = $json->{'items'}[0]->{'statistics'}->{'viewCount'};
echo number_format($views,0,'.',',');
echo json_encode($json);
 ?> 

7 comments:

  1. thats a cool way to show youtube views and other statistics thanks

    ReplyDelete
  2. hi i am php and wordpress developer my site is http://hindugeek.com I also do programming in php

    ReplyDelete
  3. The Blog is very informative. This is very Helpful. Thanks for sharing.
    PHP Training in Gurgaon

    ReplyDelete
  4. It is a proficient article that you simply have shared here. I got some unique and valuable information from your article. Thankful to you for sharing this text here. php course in delhi

    ReplyDelete
  5. The details you've shared here areIt’sextremely instructive because it contains some best knowledge, which is extremely helpful. Thanks for posting it. php course in delhi

    ReplyDelete
  6. Nice post, PHP has collection of errors so I am specifying some errors below.
    PHP Fatal error: Composer detected issues in your platform

    ReplyDelete