PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vagharshak Tozalakyan  >  YouTube Parser  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: YouTube Parser
Get the video download URL for a YouTube video
Author: By
Last change:
Date: 6 years ago
Size: 629 bytes
 

Contents

Class file image Download
<?php

$url
= 'http://youtube.com/watch?v=vso9iPIpeu8';

if (isset(
$_POST['url'])) {
    require_once
'class.YouTubeParser.php';
   
$parser = new YouTubeParser();
   
$url = trim(stripslashes($_POST['url']));
    if (!(
$link = $parser->getVideoLink($url))) {
        echo
$parser->errMsg;
    } else {
        echo
'<a href="' . $link . '">DOWNLOAD VIDEO</a>';
    }
    echo
'<br /><br />';
}

?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="url" value="<?php echo htmlspecialchars($url); ?>" style="width: 300px" />
<input type="submit" value="Go" />
</form>