Hi everyone,
I'm developing a music website and got stuck on this problem. Whenever a user submits a playlist from youtube, i fetch for video thumbnails and list them for the user. Here's the code:
<? $site = 'youtube'; }
$plID = str_replace("http://www.youtube.com/playlist?list=", "", $url);
$xmlLink = "http://gdata.youtube.com/feeds/api/playlists/" . $plID;
$xml = simplexml_load_file($xmlLink);
$videos = array();
foreach ($xml as $video) {
$vid = array();
$vid['title'] = $video->title;
$media = $video->children('http://search.yahoo.com/mrss/');
$yt = $media->group->children('http://gdata.youtube.com/schemas/2007');
$attrs = $media->group->thumbnail[0]->attributes();
$vid['thumbnail'] = $attrs['url'];
$videos[]=$vid;
}?>
It used to work fine, however now im getting the following error:
Fatal error: Call to a member function attributes() on a non-object in...
Any ideas?