mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-17 20:54:21 +00:00
22 lines
515 B
PHP
22 lines
515 B
PHP
<?php
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use Curl\Curl;
|
|
|
|
$video_ids = [
|
|
'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";
|
|
}
|