Get Total Number Of YouTube Views With PHP
Here’s a nice PHP snippet from Hal Gatewood that I’m sure YouTube account holders might be interested in. It’s a single line of PHP code that will get all of your YouTube uploaded video views (that’s right, just ONE!).
$youtube_view_count = json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/users/YOUR_CHANNEL?v=2&alt=json'))->entry->{'yt$statistics'}->totalUploadViews;
But if you prefer using a function, sure! Hal’s got one for you too.
function getYouTubeVideoViews($channel) { return json_decode(file_get_contents('http://gdata.youtube.com/feeds/api/users/' . $channel . '?v=2&alt=json'))->entry->{'yt$statistics'}->totalUploadViews; } echo getYouTubeVideoViews('YOUR_CHANNEL');
Be sure to replace YOUR_CHANNEL with that of your own.
Hope you guys like this featured quick tip/tutorial of the day. Cheers!
1 Comment
buy 1 million youtube views
01.01.2013
Hello there! This is my first comment here so I just wanted to give a quick shout out and say
I really enjoy reading through your articles. Can you suggest any other blogs/websites/forums that cover the same subjects?
Thank you so much!
There are no trackbacks to display at this time.