Login   Register  
PHP Classes
elePHPant
Icontem

File: demo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Rabotyahoff Alexandr  >  Video providers  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: demo script
Class: Video providers
Get HTML to embed and preview videos given the URL
Author: By
Last change: added dailymotion.com
Date: 2 years ago
Size: 1,162 bytes
 

Contents

Class file image Download
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <form method="get">
    <label>video link (youtube.com, vimeo.com, rutube.ru, dailymotion.com):</label>
    <input type="text" name="link">
    <input type="submit">
  </form>


<?php

if (!empty($_GET)){
    include_once 
'c_video_providers.php';

    
$link=trim($_GET['link']);

    if (!empty(
$link)){
        
$o_video_providers=new c_video_providers();

        
$video_code=$o_video_providers->get_video_code($link);
        if (
$video_code===false){
            echo 
"video provider isn't support<br>";
        }
        else {
            
$video_info=$o_video_providers->get_video_info($video_code);
            echo 
"video code: $video_code<br>";
            echo 
"link: <a href='".$video_info['url_watch']."'>".$video_info['url_watch']."</a><br>";
            echo 
"preview small: <img src='".$video_info['url_img_preview']['small']."'><br>";
            echo 
"preview medium: <img src='".$video_info['url_img_preview']['medium']."'><br>";
            echo 
"preview large: <img src='".$video_info['url_img_preview']['large']."'><br>";
            echo 
"video: ".$video_info['embed']."<br>";
        }
    }
}
?>

</html>