mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-31 12:43:14 +00:00
Add YouTube view count example
This commit is contained in:
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user