如何使用PHP实现https://developers.google.com/youtube/2.0/developers_guide_protocol_deprecated?
我尝试了什么:
<?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。
答案 0 :(得分:1)
Associating an unlinked Google Account with a YouTube channel - 这就是为什么它在文档的弃用部分。
目前提醒用户将Google帐户与频道相关联的方式在https://developers.google.com/youtube/create-channel中有所描述。该指南以移动设备为重点,但可以通过将用户重定向到{{3}来启动相同的过程在桌面上。