ALLOWED"; } else { echo "ALLOW_URL_FOPEN FORBIDDEN. USING CURL."; } ?>

Obtener el Thumbnail de un video de Vimeo/Youtube

"> "; echo "

"; echo ""; } else { echo "URL: "; echo "

"; echo ""; } ?>

Ejemplos:

https://www.youtube.com/watch?v=_t__LhOZmHs
https://vimeo.com/311618435

URL Introducida:"; echo $_POST["url"]; } ?>

"; echo "

"; } else if($image_url['host'] == 'www.vimeo.com' || $image_url['host'] == 'vimeo.com'){ $hash = file_get_contents('https://vimeo.com/api/v2/video/'.substr($image_url['path'], 1).'.json'); $hash = json_decode($hash); echo "

thumbnail_small . "\">

"; echo "

thumbnail_medium . "\">

"; echo "

thumbnail_large . "\">

"; } else { echo "
Video Provider Not Supported. Please, check URL.
"; } } function video_image_curl($url) { $image_url = parse_url($url); if($image_url['host'] == 'www.youtube.com' || $image_url['host'] == 'youtube.com'){ $array = explode('&', $image_url['query']); echo "

"; echo "

"; } else if($image_url['host'] == 'www.vimeo.com' || $image_url['host'] == 'vimeo.com'){ $url = 'https://vimeo.com/api/v2/video/'.substr($image_url['path'], 1).'.json'; $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); $return = curl_exec($curl); curl_close($curl); $return = json_decode($return); echo "

thumbnail_small . "\">

"; echo "

thumbnail_medium . "\">

"; echo "

thumbnail_large . "\">

"; } else { echo "
Video Provider Not Supported. Please, check URL.
"; } } if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!empty($_POST["url"])) { $url = $_POST["url"]; } if (ini_get('allow_url_fopen')) { video_image($url); } else { video_image_curl($url); } } ?> https://www.raulprietofernandez.net