PHP:如何在不使用登录的情况下将视频上传到YouTube?
我有一个网站,我想上传视频到YouTube上没有登录。可能吗?如果是,怎么做?不登录就无法将视频上传到YouTube title goes here description goes here category goes here Keyword goes herePHP:如何在不使用登录的情况下将视频上传到YouTube?,php,youtube,Php,Youtube,我有一个网站,我想上传视频到YouTube上没有登录。可能吗?如果是,怎么做?不登录就无法将视频上传到YouTube title goes here description goes here category goes here Keyword goes here 也就是说,如果YouTube的条款和条件禁止通过登录自动上传,我也不会感到惊讶。为您网站的所有用户创建一个帐户并始终使用其凭据。如果没有“负责”视频的用户帐户,您就无法上传视频@佩卡:请求原谅,而不是许可?;) title g
也就是说,如果YouTube的条款和条件禁止通过登录自动上传,我也不会感到惊讶。为您网站的所有用户创建一个帐户并始终使用其凭据。如果没有“负责”视频的用户帐户,您就无法上传视频@佩卡:请求原谅,而不是许可?;) title goes here description goes here category goes here Keyword goes here
谷歌至少在这里有一个youtube API(带有上传功能和PHP示例):有一种方法可以在没有zend客户端库的情况下实现这一点。它的核心是php(PHP4)。
title goes here description goes here category goes here Keyword goes here title goes here description goes here category goes here Keyword goes here 注意:AuthSub现在已弃用。有关详细信息,请参阅Google弃用策略 title goes here description goes here category goes here Keyword goes here
编辑:
由于
codershelpingcoders.com
现在指向godaddy的停车页面,并且原始链接Zendutorials.wordpress.com
有一篇链接到codershelpingcoders.com
的空文章,我通过存档找到了原始文章:并尝试复制此答案中的内容,以供将来参考(注意:我不知道这个信息是否仍然有效)
title goes here
description goes here
category goes here
Keyword goes here
本教程介绍使用AuthSub的基于浏览器的直接上载技术
title goes here
description goes here
category goes here
Keyword goes here
AuthSub
是YouTube的授权模块,允许您的应用程序与YouTube进行交互,以实现特定目的,例如代表用户上传视频等。它与
Auth
相同,是oAuth
的近亲用户将特权授予您的站点应用程序,您可以代表他完成这项工作,就这么简单 title goes here description goes here category goes here Keyword goes here 我们将使用
AuthSub
上传视频
title goes here
description goes here
category goes here
Keyword goes here
如下所示,可通过以下4个简单步骤完成:
title goes here
description goes here
category goes here
Keyword goes here
因此,我们实施的第一步是获得用户授权的应用程序。
我们只需将用户重定向到url的授权页面即可 详情如下: $nextUrl = urlencode(‘http://www.xxxx.com’) $scope = urlencode(‘http://gdata.youtube.com’); https://www.google.com/accounts/AuthSubRequest?next=’.$nextUrl.’&scope=’.$scope.’&session=1&secure=0 title goes here description goes here category goes here Keyword goes here 同样,curl也有事情要做。您将通过发出另一个curl调用来上载此内容: title goes here description goes here category goes here Keyword goes here url:http://gdata.youtube.com/action/GetUploadToken headers:AuthSub token=”Your AuthSubSession token goes here” GData-Version:2 ‘X-GData-Key: key=”Your Api key goes here” Content-length: length of the xml you formed above goes here Content-Type:application/atom+xml; charset=UTF-8 POSTFIELDS: the xml itself that you formed 网址:http://gdata.youtube.com/action/GetUploadToken headers:AuthSub-token=“您的AuthSub会话令牌位于此处” GData版本:2 'X-GData-Key:Key=“您的Api密钥在这里” 内容长度:您在上面形成的xml的长度如下 内容类型:应用程序/atom+xml;字符集=UTF-8 POSTFIELDS:您形成的xml本身
现在您将创建一个表单,该表单将此url作为其操作和令牌 像这样的隐藏字段。
只需选择视频并单击提交,您的视频就会上传。
成功提交后,您将被重定向回
状态200
示例代码的github链接是。因为codershelpingcoders.com现在指向godaddy的停车页面,而原始链接Zendutorials.wordpress.com有一篇链接到codershelpingcoders.com的空文章,所以我通过存档找到了原始文章:并尝试复制此答案中的内容以供将来参考(注意:我不知道这个信息是否仍然有效)。 title goes here description goes here category goes here Keyword goes here