View Single Post
Old 12-13-2012, 06:44 PM   PM User | #6
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
Here is an example:

http://dev.tempz.webatu.com/youtube-test/


PHP Code:

<div style="float:left;">
<iframe width="560" height="315" src="http://www.youtube.com/embed/Yx82V2zN3tQ" frameborder="0" allowfullscreen></iframe>

<p>
<div style="float:left; display:inline;">
Views:
<?php
$video_ID 
'Yx82V2zN3tQ'//http://www.youtube.com/watch?v=[Yx82V2zN3tQ]
$JSON file_get_contents("https://gdata.youtube.com/feeds/api/videos/{$video_ID}?v=2&alt=json");
$JSON_Data json_decode($JSON);
$views $JSON_Data->{'entry'}->{'yt$statistics'}->{'viewCount'};
echo 
$views;
?>
</div>
</div>
tempz is offline   Reply With Quote