PHP Classes
elePHPant
Icontem

File: simple_example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arturs Sosins  >  Media Embed  >  simple_example.php  >  Download  
File: simple_example.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: Media Embed
Embed video and images from remote sites
Author: By
Last change: Accessible without user login
Date: 4 years ago
Size: 1,344 bytes
 

Contents

Class file image Download
<?php
/*************************************************************
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
 * Feel free to distribute and modify code, but keep reference to its creator
 *
 * Media Embed class allows you to retrieve information about media like Video or Images
 * by simply using link or embed code from media providers like Youtube, Myspace, etc.
 * It can retrieve embeding codes, title, sizes and thumbnails from
 * more than 20 popular media providers
 *
 * For more information, examples and online documentation visit:
 * http://webcodingeasy.com/PHP-classes/Get-information-about-video-and-images-from-link
**************************************************************/
//include class
include("media_embed.php");

//provide media link
$em = new media_embed('http://youtu.be/xs-rgXUu448');

//check if found anything useful
$site = $em->get_site();
if(
$site != "")
{
    echo
"<p>Link to media:</p>";
    echo
"<p><a href='".$em->get_url()."'>";
    echo
"<img src='".$em->get_thumb("small")."'/>";
    echo
"</a></p>";
    echo
"<p>Or embed it:</p>";
    echo
"<p>";
   
$code = $em->get_iframe();
    if(
$code == "")
    {
       
$code = $em->get_embed();
    }
    echo
$code;
    echo
"</p>";
}
else
{
    echo
"<h3>Cannot get info from this source</h3>";
}
?>