Created
February 17, 2015 17:03
-
-
Save steve10287/b6842167dbee3a0db889 to your computer and use it in GitHub Desktop.
youtube feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $channel_name = 'SubaruGlobalTV';//Be sure to change this to your channel | |
| $count = 1;//# of videos you want to show (MAX = 20) | |
| $em_width = "100%";//width of embedded player | |
| $em_height = 500;//height of embedded player | |
| $wrap_class = 'video';//class name for the div wrapper | |
| //The output... | |
| $sxml = simplexml_load_file("http://gdata.youtube.com/feeds/api/users/$channel_name/uploads?max-results=$count"); | |
| foreach ($sxml->entry as $entry) { | |
| $vidKey = substr(strrchr($entry->id,'/'),1); | |
| echo "<div class=\"$wrap_class\"> | |
| <iframe width=\"$em_width\" height=\"$em_height\" src='https://www.youtube.com/embed/".$vidKey."?modestbranding=0&rel=0&showinfo=0&autohide=1'" . "frameborder=\"0\" allowfullscreen></iframe> | |
| </div>"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment