Add YouTube view count example

This commit is contained in:
Zach Borboa
2014-05-18 01:29:46 -07:00
parent 34742ee9e2
commit 55666135af
+19
View File
@@ -0,0 +1,19 @@
<?php
require '../src/Curl.class.php';
$video_ids = array(
'9bZkp7q19f0',
'_OBlgSz8sSM',
'uelHwf8o7_U',
'KQ6zr6kCPj8',
'ASO_zypdnsQ',
'pRpeEdMmmQ0',
);
foreach ($video_ids as $video_id) {
$curl = new Curl();
$curl->get('https://gdata.youtube.com/feeds/api/videos/' . $video_id . '?alt=json');
echo '"' . $curl->response->entry->title->{'$t'} . '" has ' .
number_format($curl->response->entry->{'yt$statistics'}->viewCount) . ' views.' . "\n";
}