我试过两种方式:
第一:
$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);
第二
$url="https://i.ytimg.com/vi/2ve6PEagFJc/maxresdefault.jpg";
echo $data=file_get_contents($url); //(it is returning **false** always)
如何在php中使用YouTube api v3
获取缩略图内容?
答案 0 :(得分:0)
这段代码对我有用
H