working solution/exmample:
function getSslPage($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
//params
$order = "date";
$part = "snippet";
$channel_id = "UCzocxfp9lrNal14glrFSrng";
$max_results = 50;
$api_key = "YOUR_API_KEY";
$feedurl = 'https://www.googleapis.com/youtube/v3/search?order='.$order.'&part='.$part.'&channelId='.$channel_id.'&maxResults='.$max_results.'&key='.$api_key;
$feed = getSslPage($feedurl);
$feed_arr = json_decode($feed, true);
//print_r($feed_arr);
$items = $feed_arr['items'];
foreach($items as $item) {
if( (isset($item['id']['videoId'])) OR (!empty($item['id']['videoId'])) ) {
echo '<iframe width="420" height="315"
src="http://www.youtube.com/embed/'.$item['id']['videoId'].'?autoplay=0">
</iframe>';
}
}