从YouTube播放列表中获取所有视频ID到PHP阵列

My goal is to use a playlist ID to get the video ID of each video within that playlist.

I'm having trouble figuring out YouTube's API (I'm a relatively new programmer).

Basically, I want to:

  1. Send an XML request to http://gdata.youtube.com/feeds/api/playlists/ID_OF_PLAYLIST
  2. Using the response (which is the part I don't understand how to navigate), append all the video IDs to an array.

Seems pretty straightforward. I've been grabbing the information from YouTube using simplexml_load_file($url); in case that is important.

Thanks for the help!

Here you go, I made an example:

<?php
$data = file_get_contents('http://gdata.youtube.com/feeds/api/playlists/PL4BC045240D2FB11B/?v=2&alt=json&feature=plcp');

if (!$data)
    throw new Exception("Data retrieval failed.");

$dataAsArray = json_decode($data);
$feed = $dataAsArray->feed->entry;

$videoID_array = array();

if(count($feed))
{
    foreach($feed as $item)
        array_push($videoID_array, $item->{'media$group'}->{'yt$videoid'}->{'$t'});
}

print_r($videoID_array);

?>

Where PL4BC045240D2FB11B of course is the Playlist ID! Example PHPFiddle