I tried this in 2 ways:
First:
$url= "https://i.ytimg.com/vi/2ve6PEagFJc/maxresdefault.jpg";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, (string)$url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$raw_contents = curl_exec($curl);//(it is returning **false** always)
curl_close($curl);
Second:
$url="https://i.ytimg.com/vi/2ve6PEagFJc/maxresdefault.jpg";
echo $data=file_get_contents($url); //(it is returning **false** always)
How can I get thumbnail image content using YouTube api v3
in php?
This code worked for me