The concept idea here is that The database would store the youtube channel users name in a cell called YOUTUBE.
I needed the code to look up the USERDB, look up the YOUTUBE cell and retrieve all the usernames that were stored in a list (any blank cells would not show).
From here I needed the code to place users youtube username from the YOUTUBE cell into the FEEDURL
I needed this looped so it would do each individual user from the result. The problem I am getting is that the FEEDURL is showing all the users usernames in the URL instead of one.
EG. http://gdata.youtube.com/feeds/api/users/PewDiePie,MissFushi/uploads?max-results=13
but I need it to be like
EG. http://gdata.youtube.com/feeds/api/users/MissFushi/uploads?max-results=13
here is my code
$communityvideos = mysql_query("SELECT youtube FROM userdb WHERE rights='user' && youtube IS NOT NULL");
while($youtube = mysql_fetch_array($communityvideos)) {
$v[] = $youtube["youtube"];
}
$youtube2 = implode(',', array_filter($v));
$usernames = array($youtube2);
error_reporting(E_ALL);
foreach ($usernames as $user) {
$feedURL = 'http://gdata.youtube.com/feeds/api/users/' . $user .'/uploads?max-results=13';
$sxml = simplexml_load_file($feedURL);
}
$i=0;
foreach ($sxml->entry as $entry) {
$media = $entry->children('media', true);
$watch = (string)$media->group->player->attributes()->url;
$thumbnail = (string)$media->group->thumbnail[0]->attributes()->url;
parse_str( parse_url( $watch, PHP_URL_QUERY ), $my_array_of_vars);
Finally I only want 13 videos showing in total. Not 13 videos from each user, just 13 from all the users joined together. Any ideas on that?