Search code examples
phpyoutubewrapper

YouTube PHP Wrapper


Is there any YouTube php wrapper that I can use to retrieve video's rating by their id?


Solution

  • Use Zend/Google's PHP library. From Zend's Zend_Gdata_YouTube documentation:

    <?php
      $yt = new Zend_Gdata_YouTube($httpClient,
                             $applicationId,
                             $clientId,
                             $developerKey);
    ?>
    

    From the (perhaps better documented) Google site:

    <?php
      $videoEntry = $yt->getVideoEntry('the0KZLEacs');
      echo 'Rating: ' . $videoEntry->getVideoRatingInfo() . "\n";
    ?>