Get the Youtube Video Thumbnail from Youtube video Url using PHP?

To extract the identifier from the following URL : $url = 'youtube.com/watch?v=B4CRkpBGQzU&feature=... You can first use parse_url() to get the query string : $queryString = parse_url($url, PHP_URL_QUERY); var_dump($queryString) Which, here, would give you : string 'v=B4CRkpBGQzU&feature=youtube_gdata&par1=1&par2=2' (length=49) And, then, use parse_str() to extract the parameters from that query string : parse_str($queryString, $params); var_dump($params) Which would get you the following array : array 'v' => string 'B4CRkpBGQzU' (length=11) 'feature' => string 'youtube_gdata' (length=13) 'par1' => string '1' (length=1) 'par2' => string '2' (length=1) And, now, it's just a matter of using the v item from that array, injecting it into the thumbnail URL : if (isset($params'v')) { echo "i3.ytimg. Com/vi/{$params'v'}/default. Jpg"; } Which gives : i3.ytimg.Com/vi/B4CRkpBGQzU/default.jpg.

To extract the identifier from the following URL : $url = 'youtube.com/watch?v=B4CRkpBGQzU&feature=...; You can first use parse_url() to get the query string : $queryString = parse_url($url, PHP_URL_QUERY); var_dump($queryString); Which, here, would give you : string 'v=B4CRkpBGQzU&feature=youtube_gdata&par1=1&par2=2' (length=49) And, then, use parse_str() to extract the parameters from that query string : parse_str($queryString, $params); var_dump($params); Which would get you the following array : array 'v' => string 'B4CRkpBGQzU' (length=11) 'feature' => string 'youtube_gdata' (length=13) 'par1' => string '1' (length=1) 'par2' => string '2' (length=1) And, now, it's just a matter of using the v item from that array, injecting it into the thumbnail URL : if (isset($params'v')) { echo "i3.ytimg. Com/vi/{$params'v'}/default. Jpg"; } Which gives : i3.ytimg.Com/vi/B4CRkpBGQzU/default.jpg.

Thanks... Will try it – Neo Jul 24 at 16:30 1 @Neo accept this answer. It is the best one. – Mike Jul 24 at 17:28.

V=(.*)|", $url); $thumb_default = file_get_contents("

"); $thumb1 = file_get_contents("
"); $thumb2 = file_get_contents("
"); $thumb3 = file_get_contents("
"); $thumb4 = file_get_contents("
").

You can use a explode url like this $youtube = " youtube.com/watch?v=B4CRkpBGQzU&feature=...; $explode = explode("&",$youtube); echo $explode0;//$explode1.

V=(.*)&feature/',$url, $matches); This will get you the 'B4CRkpBGQzU' part in $matches1.

This won't get you thumbnail – genesis Jul 24 at 16:21 Edited it. Forgot to include $matches. Then just use $matches how you wish to create the new URL.

– Mike Jul 24 at 16:27.

Display a video play list. $play = 'video = "http://www.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions