Advertisement
okardec

Uso da Classe YoutubeAPI3

May 7th, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. /**
  2. *  exemplo de uso da classe YoutubeAPI3 >>  http://pastebin.com/pM1SVipb
  3. */
  4. //recuperar os dados do vĂ­deo especifico
  5. $id_video = "OBl4pp0Sfko";
  6.  
  7. $api = new YoutubeAPI3('videos',$id_video,array('snippet','contentDetails','statistics','status'));
  8. if (!$api->isValidResponse()){
  9.     throw new Exception($api->getErrorDescription());
  10. }
  11. ///para retornar os dados
  12. $json = $api->getJSON(); ///retorna o json conforme esta na API do Youtube
  13. ///ou
  14. $json = $api->fetchVideoData(); ///retorna um json personalizado mais limpo
  15.  
  16. print_r($json);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement