Uncaught exception 'Zend_Gdata_App_HttpException

送分小仙女□ 提交于 2019-12-24 00:35:59

问题


here is my code.

// Instantiate the parent object

    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/';

I think the error is in this line $authenticationURL = 'http://www.google.com/accounts/ClientLogin'; it is supposed to be https://www.google.com/accounts/ClientLogin but if i change it to "http" it doesn't show error but the other functionality is not working and the show this error.

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

来源:https://stackoverflow.com/questions/12561307/uncaught-exception-zend-gdata-app-httpexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!