问题
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