Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getResults($query, $max, $p){
- $ch = @curl_init("http://gdata.youtube.com/feeds/api/videos?v=2&format=5&alt=jsonc&max-results=".$max."&start-index=".$p."&q=" .urlencode($query));
- @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11");
- $content = @curl_exec($ch);
- @curl_close($ch);
- $content = @json_decode($content);
- $items = (array) $content->{'data'}->{'items'};
- $names = array();
- foreach($items as $item) {
- $item = (array) $item;
- $names[$item['id']] = $item['title'];
- }
- return $names;
- }
- function getTotalResults($query) {
- $ch = @curl_init("http://gdata.youtube.com/feeds/api/videos?v=2&format=5&alt=jsonc&q=" .urlencode($query));
- @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11");
- $content = curl_exec($ch);
- @curl_close($ch);
- $content = @json_decode($content);
- $items = (array) $content->{'data'}->{'items'};
- $names = array();
- foreach($items as $item) {
- $item = (array) $item;
- $names[$item['id']] = $item['title'];
- }
- return $names;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement