getYouTubeCode($videoLink);
if($vid) {
$result = $yt->processVideo($vid);

if($result) {
//print_r($result);
$info = $result[‘videos’][‘info’];
$formats = $result[‘videos’][‘formats’];
$adapativeFormats = $result[‘videos’][‘adapativeFormats’];

$videoInfo = json_decode($info[‘player_response’]);

$title = $videoInfo->videoDetails->title;
$thumbnail = $videoInfo->videoDetails->thumbnail->thumbnails{0}->url;
}
else {
$error = “Something went wrong”;
}

}
}
else {
$error = “Please enter a YouTube video URL”;
}
}
?>