Get YouTube video thumbnail using PHP

0
131
How to get YouTube Video Thumbnail

welcome back to shortlearner.com , in our previous post we learn how to convert YouTube URL to embed URL PHP.in this post we will see how to Get YouTube video thumbnail and use it with PHP
so in the below code we explode the URL and create a link which will show the thumbnail of individual video id and use it on img tag.

How to get YouTube Video Thumbnail

Also Read :
How to Install PHP on CentOS.
How to integrate Razorpay Payment Gateway using PHP.

Get Domain name from URL
Unable to create a directory a wordpress error
How to Send Attachment on mail using PHP.
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

<?php
$text = "https://www.youtube.com/watch?v=74WSXAFXoDk";
$video_id = explode("?v=", $text);
$video_id = $video_id[1];
$thumbnail="http://img.youtube.com/vi/".$video_id."/maxresdefault.jpg";
echo "<img src='$thumbnail'>";
?>