列表YouTube嵌入在本地播放列表中

I've managed to create a php script to build a playlist from a selection of videos. It works the way I want, mostly

if ($search_term){
  echo "</br><h3>Search term used: " . $search_term . "</h3>";
  $result = "<iframe width=\"720\" height=\"405\" src=\"https://www.youtube.com/embed/?playlist=";
  $last = count($playlist) -1;
  for ($k=0; $k < count($playlist); $k++){
    if ($k < $last){
      $result = $result . $playlist[$k]['videoid'] . ",";
    } else {
      $result = $result . $playlist[$k]['videoid'] . "&showinfo=1&listType=playlist&rel=0\" frameborder=\"0\" allowfullscreen>";
    }
  }
    echo $result;
}

The only thing missing is having a list of the videos in the playlist as is done on the YouTube home site.

I'm wondering if the API can create a similar playlist or if I will have to build a kludgy version myself?