PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Debugged Interactive Designs  >  Php5tube  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Drop this test script in the same directory as the class source
Class: Php5tube
Get information about videos using YouTube API
Author: By
Last change:
Date: 8 years ago
Size: 1,563 bytes


Class file image Download

//get or create youtube username
if( isset($_GET['user']) ){$youtube_user = $_GET['user'];}
else {
$youtube_user = 'rickrolled';}

//create php5tube object and get videos
$php5tube = new Php5tube('Video','User','Comment');
$videos = $php5tube->getUserVideos($youtube_user);

//dump array of views



<table cellpadding="0" cellspacing="0">

<?php foreach($videos as $video) { ?>
    <div style="padding:2px;"><img src="<?php echo $video['Video']['thumbnail_url1']; ?>"></div>
    <div style="padding:2px;"><img src="<?php echo $video['Video']['thumbnail_url2']; ?>"></div>
    <div style="padding:2px;"><img src="<?php echo $video['Video']['thumbnail_url3']; ?>"></div>
    <div style="padding:10px;">
        <a href="<?php echo $video['Video']['youtube_id']; ?>">
            <img src="<?php echo $video['Video']['thumbnail_url4']; ?>">
    <div style="font-size:16pt;"><?php echo $video['Video']['title']; ?></div>
    <div><b>Category</b> = <?php echo $video['Video']['category']; ?> times</div>
    <div><b>Tags</b> = <?php echo $video['Video']['keywords']; ?> times</div>
    <div><b>Description</b> = <?php echo $video['Video']['description']; ?></div>
    <div><b>Views</b> = <?php echo $video['Video']['view_count']; ?> times</div>
    <div><b>Marked as favorite</b> = <?php echo $video['Video']['favorite_count']; ?> times</div>
<?php } ?>