Advertisement
Guest User

Vimeo API - PHP Example

a guest
Feb 25th, 2013
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <?php
  2. require_once('vimeo.php');
  3. session_start();
  4.  
  5. // Curl helper function
  6. function curl_get($url) {
  7. $curl = curl_init($url);
  8. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  9. curl_setopt($curl, CURLOPT_TIMEOUT, 30);
  10. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  11. $return = curl_exec($curl);
  12. curl_close($curl);
  13. return $return;
  14. }
  15.  
  16.  
  17. // Create the object and enable caching
  18. $vimeo = new phpVimeo('KEY SAVED', 'KEY SAVED');
  19. $vimeo->setToken('KEY SAVED','KEY SAVED');
  20.  
  21. $vimeo->enableCache(phpVimeo::CACHE_FILE, './cache', 300);
  22.  
  23. $videos = $vimeo->call('vimeo.videos.getAll', array('format' => 'xml', 'sort' => 'newest', 'full_response' => '1', 'summary_response' => '1'));
  24.  
  25.  
  26. ?>
  27.  
  28.  
  29. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  30. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  31.  
  32. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  33. <head>
  34. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  35. <title>Vimeo Advanced API OAuth Example</title>
  36. </head>
  37. <body>
  38.  
  39. <h1>Vimeo Advanced API OAuth Example</h1>
  40.  
  41. <?php
  42.  
  43. //$vars = get_defined_vars();
  44. //print_r($vars);
  45.  
  46.  
  47. error_reporting(E_ALL);
  48.  
  49. $ch = curl_init($videos);
  50. curl_setopt($ch, CURLOPT_HEADER, 0);
  51. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  52. $xml = curl_exec($ch);
  53. print strlen($xml)." bytes received.\n";
  54.  
  55. ?>
  56.  
  57. </body>
  58. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement