PHP Classes
elePHPant
Icontem

File: teste.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Carlson A. Soares  >  YouTube URL parser  >  teste.php  >  Download  
File: teste.php
Role: Example script
Content type: text/plain
Description: test the class
Class: YouTube URL parser
Embed YouTube videos given their page URLs
Author: By
Last change:
Date: 4 years ago
Size: 802 bytes
 

Contents

Class file image Download
<?php
   
require_once('youtube.php');
   
   
$yt = new YouTube();
   
   
$ids = array( $yt->getId('http://www.youtube.com/watch?v=r0xO-vvdgok&feature=topvideos'),
                 
$yt->getId('http://www.youtube.com/watch?v=hLZIBO8szRM&feature=topvideos'),
                 
$yt->getId('http://www.youtube.com/watch?v=McfFTm-uNuI&feature=related'),
                 
$yt->getId('http://www.youtube.com/user/csoares289#p/c/7D3AECB805EE5786/4/t_c3rPXICY8') );
   
    echo
'<style>th,td{border: 1px solid #000}</style><table><tr><th>ID</th><th>Generated Link</th><th>Embedded Video</th></tr>';
   
    foreach(
$ids as $id ){
        echo
"<tr><td>$id</td><td>", $yt->generateLink( $id ), '</td><td>', $yt->generateEmbedded( $id ),'</td></tr>';
    }
    echo
'</table>';
   
?>