[eluser]jplanet[/eluser]
I am using this code to create a form to upload a video to Youtube. It successfully generated the form without error, but when I submit the form, I just get a 401 User Authentication Required Error...not sure where to go with this:
Code:
$this->load->library('zend');
$this->zend->load('Zend/Gdata/YouTube');
$this->zend->load('Zend/Gdata/ClientLogin');
$this->zend->load('Zend/Gdata/AuthSub');
$authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
$username = $this->config->item('youtube_username'),
$password = $this->config->item('youtube_password'),
$service = 'youtube',
$client = null,
$source = 'Arts Connector', // a short string identifying your application
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);
$developerKey = $this->config->item('devkey');
$applicationId = 'Arts Connector';
$clientId = 'My video upload client - v1';
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie');
// The category must be a valid YouTube category!
$myVideoEntry->setVideoCategory('Autos');
// Set keywords. Please note that this must be a comma-separated string
// and that individual keywords cannot contain whitespace
$myVideoEntry->SetVideoTags('cars, funny');
$tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
$tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
$data['tokenValue'] = $tokenArray['token'];
$postUrl = $tokenArray['url'];