如何实现https://developers.google.com/youtube/2.0/developers_guide_protocol_deprecated使用PHP?
我尝试过的:
<?php
$headers = array("PUT /feeds/api/users/default HTTP/1.1",
"Host: gdata.youtube.com",
"Content-Type: application/atom+xml",
"Authorization: Bearer ACCESS_TOKEN",
"X-GData-Key: key=DEVKEY",
"Content-length: ".strlen($data),
$curl = curl_init("https://gdata.youtube.com/feeds/api/users/default?v=2.1");
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_REFERER, true);
curl_setopt($curl, CURLOPT_HEADER, 0);
$returnxxx = curl_exec($curl);
curl_close($curl);
echo $returnxxx;
?>
不过我错过了ACCESS_TOKEN。
通过API将未链接的Google帐户与YouTube频道关联起来不再可能,这就是为什么它出现在文档中不推荐使用的部分。
提示用户将谷歌帐户链接到频道的当前方式在https://developers.google.com/youtube/create-channel该指南以移动为重点,但通过将用户重定向到https://www.youtube.com/create_channel在桌面上。