-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
52 lines (36 loc) · 1.56 KB
/
index.php
File metadata and controls
52 lines (36 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once('lib/Vimeo.php');
//Sankar API
$consumer_key = "7d56781df87ee448ef321ab19d7e8e93cabf8533";
$consumer_secret_key = "TeYM3/6CBPLaVYPgroBuP7JGeuPox+DnRjqV5P9nD4pV8hbKhesE0xtrXhaKI17GIpfzIM9GRDUMysJI8jlor1utVIqdUYL/lvF/Lo7sIPoFAT/lgiUh0cvFYQ3ePfRW";
$access_token = "ccac204f159c17ef2eb49903e6f5353a";
$vimeo = new Vimeo($consumer_key, $consumer_secret_key, $access_token);
$channel_video_array = [];
$video_data_array = get_channel_video_data();
echo count($video_data_array);
function get_channel_video_data($page_number = null) {
$video_endpoint_url = '/channels/nicetype/videos?per_page=100';
// $video_endpoint_url = '/users/63133666/videos?per_page=100';
if($page_number != null) {}
$video_endpoint_url.'&page='.$page_number;
$channel_data = $GLOBALS['vimeo']->request($video_endpoint_url);
$rate_ratelimit_remaining = $channel_data['headers']['X-RateLimit-Remaining'];
if($rate_ratelimit_remaining == 0):
echo "Rate limit exceeded. Please try again some time";
return false;
else:
$paging_object = (object) $channel_data['body']['paging'];
$video_array = $channel_data['body']['data'];
foreach($video_array as $video) {
array_push($GLOBALS['channel_video_array'], $video);
}
$next_page = getPageNumber($paging_object->next,'page');
return $GLOBALS['channel_video_array'];
endif;
}
function getPageNumber($url, $url_param) {
$parsed_url = parse_url($url);
parse_str($parsed_url['query'], $query);
return $query[$url_param];
}
?>