Location: PHPKode > scripts > Media Embed > simple_example.php
<?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>";
}
?>
Return current item: Media Embed