2

我已经通过 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);
?

它在我的本地主机中完美运行,但在我的服务器中出现以下错误,

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

这里有什么问题?

4

0 回答 0