通过卷曲连接youtube?

时间:2013-03-07 12:13:16

标签: php curl youtube-api

我已通过curl连接youtube以从我的服务器上传视频,以下是我的代码

<?php
$youtube_email = "------------------------"; // Change this to your youtube sign in email.
$youtube_password = "----------------"; // Change this to your youtube sign in password.

$postdata = "Email=".$youtube_email."&Passwd=".$youtube_password."&service=youtube&source=Example";
$curl = curl_init("https://www.google.com/youtube/accounts/ClientLogin");
curl_setopt($curl, CURLOPT_HEADER, "Content-Type:application/x-www-form-urlencoded");
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
$rr= curl_getinfo($curl);

$response = curl_exec($curl);

curl_close($curl);
 print_r($response);
?

它完全在我的localhost中工作,但在我的服务器中我得到了以下错误,

Error=BadAuthentication Url=https://www.google.com/accounts/ServiceLogin?service=youtube#Email=xxxx@gmail.com

这里有什么问题?

0 个答案:

没有答案