• We had a custom site created for a customer and the programmer added a feature that grabbed a YouTube feed from a channel and then displayed it on the website using the YouTube v2 API. I am no longer able to get a hold of the developer and am wondering if anyone could me alter the code to work with the new YouTube v3 API? Below is the code from the v2 API:

    <div id="vid-slider" class="container">
          <h4>Watch Our Videos</h4>
          <div class="flexslider">
            <ul class="slides">
                <?php
                $get = file_get_contents("https://gdata.youtube.com/feeds/base/users/RWFHDental/uploads?alt=json&v=2&orderby=published&client=ytapi-youtube-profile");
                $decode = json_decode($get, TRUE); // TRUE for in array format
    
                foreach ($decode['feed']['entry'] as $entry) {
                    $idfull = $entry['id']['$t'];
                    $pos = strrpos($idfull, "video:")+6;
                    $id = substr($idfull, $pos);
    				$vidpath = $entry['link'][0]['href'];
                    echo '<li><a href="'.$id.'" class="launch-vid" data-toggle="modal"><span class="play-icon"></span><img src="https://img.youtube.com/vi/' . $id . '/mqdefault.jpg"></a></li>';
                }
                ?>
    
            </ul>
          </div>
      </div>

  • The topic ‘Migrate Youtube API to version 3’ is closed to new replies.