未捕获的异常'Zend_Gdata_App_HttpException

时间:2012-09-24 08:25:02

标签: youtube-api zend-gdata

这是我的代码。

//实例化父对象

    parent::__construct(false, 'Youtube Upload');
    set_include_path(TEMPLATEPATH . '/inc/');
    require_once ( 'Zend/Loader.php');
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

    $authenticationURL = 'http://www.google.com/accounts/ClientLogin';

    // set video params to authenticate user
    $this->httpClient = Zend_Gdata_ClientLogin::getHttpClient(
            $username = $this->username,
            $password = $this->password,
            $service = 'youtube', 
            $client = null, 
            $source = 'youtubeAPi',
            $loginToken = null,
            $loginCaptcha = null, 
            $authenticationURL
    );

$yt = new Zend_Gdata_YouTube($youtube->httpClient, '', '', $youtube->api_key);
$video = new Zend_Gdata_YouTube_VideoEntry();
$date = md5(strtotime("now") . rand());
$video->setVideoTitle("{$_POST['title']}");
$video->setVideoDescription("{$_POST['description']}");
// $video->setVideoPrivate();
$video->setVideoCategory("{$_POST['category']}");
$video->SetVideoTags("{$_POST['tags']}");

$handler_url = 'https://gdata.youtube.com/action/GetUploadToken';
$token_array = $yt->getFormUploadToken($video, $handler_url);
$token = $token_array['token'];
$post_url = $token_array['url'];
$next_url = 'https://bazaar.me/orbit/youtube/';

我认为错误就在这一行    $ authenticationURL ='http://www.google.com/accounts/ClientLogin';它应该是https://www.google.com/accounts/ClientLogin,但如果我将其更改为“http”,它不会显示错误,但其他功能不起作用,并显示此错误。

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401 

0 个答案:

没有答案