i've found that I can get a list of a youtube channel's videos by viewCount (hits) and limit the results with the link below
http://gdata.youtube.com/feeds/api/users/edbassmaster/uploads?orderby=viewCount&max-results=5
this of course returns some xml feed code. I am trying to list the videos onto my website in a div.
what i've tried:
<?php
$list = Array();
//get the xml data from youtube
$url = "http://gdata.youtube.com/feeds/api/users/edbassmaster/uploads?orderby=viewCount&max-results=5";
$xml = simplexml_load_file($url);
//load up the array $list['title'] = $xml->title[0];
$list['title'] = $xml->title[0];
echo $list['title'];
?>
So far that just gives me the title for the xml feed, if I try $xml->title[1]
. It doesn't return anything. How can I use that xml feed to list the titles and (href) link them to the videos? I'm trying to retrieve 2 things from the xml source, the title of the video and the url.
Thanks.