Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4545916
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:52:49+00:00 2026-05-21T15:52:49+00:00

I am doing a site in cakephp where users can upload videos and those

  • 0

I am doing a site in cakephp where users can upload videos and those get published on the site once approved by the moderator. Currently, I am accepting video files which are being uploaded on my server. These files will be downloaded and checked by the moderator and if they seem fine the moderator will click a button that would upload the video to youtube and save a link to it in the database.

Now, I am using ClientLogin to authenticate with YouTube and trying to upload the video by using the Zend Gdata Libraries. There is not much documentation available on it and I am also not getting any error back, but its not working:

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_CLientLogin');
Zend_Loader::loadClass('Zend_Gdata_App_Exception');
Zend_Loader::loadClass('Zend_Gdata_App_AuthException');
Zend_Loader::loadClass('Zend_Gdata_App_HttpException');
Zend_Loader::loadClass('Zend_Gdata_YouTube_VideoEntry');

// Define variables
$email = 'myemail@gmail.com';
$passwd = 'pass';
$applicationId = 'company-app-1.0';
$developerKey = 'AI39si5GGdQnX588uduNxgZL6I_UW32dr43FVH0ehf2jqN3CBIk5PIZHOG1-ag_Q8eaVlWnIxP7fLS3UW5Ofg45MzAxmW4XyAFw';

// Creating a ClientLogin authenticated Http Client
try {
    $client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'cl');
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
    echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n";
    echo 'Token ID: ' . $cre->getCaptchaToken() . "\n";
} catch (Zend_Gdata_App_AuthException $ae) {
    echo 'Problem authenticating: ' . $ae->exception() . "\n";
}

// Passing a Developer Key and ClientID to Zend_Gdata_YouTube
$yt = new Zend_Gdata_YouTube($client, $applicationId, null, $developerKey);


// Uploading a video

$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource('001.mov');
$filesource->setContentType('video/quicktime');
$filesource->setSlug('001.mov');
$myVideoEntry->setMediaSource($filesource);
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie');

// Note that category must be a valid YouTube category !
$myVideoEntry->setVideoCategory('Comedy');

// Set keywords, note that this must be a comma separated string
// and that each keyword cannot contain whitespace
$myVideoEntry->SetVideoTags('baby, funny');

// Optionally set some developer tags
/*
$myVideoEntry->setVideoDeveloperTags(array('mydevelopertag', 'anotherdevelopertag'));
*/

// Set Video as Private
$myVideoEntry->setVideoPrivate();

// Upload URI for the currently authenticated user

$uploadUrl = 'http://uploads.gdata.youtube.com/feeds/app/default/uploads';


// Try to upload the video, catching a Zend_Gdata_App_HttpException
// if availableor just a regular Zend_Gdata_App_Exception
try {
    $newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
} catch (Zend_Gdata_App_HttpException $httpException) {
    echo $httpException->getRawResponseBody();
} catch (Zend_Gdata_App_Exception $e) {
    echo $e->getMessage();
}

try {
    $control = $videoEntry->getControl();
} catch (Zend_Gdata_App_Exception $e) {
    echo $e->getMessage();
}

if ($control instanceof Zend_Gdata_App_Extension_Control) {
    if ($control->getDraft() != null && $control->getDraft()->getText() == 'yes') {
        $state = $videoEntry->getVideoState();
        if ($state instanceof Zend_Gdata_YouTube_Extension_State) {
            print 'Upload status: ' . $state->getName() .' '. $state->getText();
        } else {
            print 'Not able to retrieve the video status information' .' yet. ' . "Please try again shortly.\n";
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:52:49+00:00Added an answer on May 21, 2026 at 3:52 pm

    apparently, it was giving me a blank screen on my localserver but its working fine on the live server. also i had not changed the default in the uploadUrl to my username.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing an jQuery ajax call to an XML page in my CakePHP site.
I am trying to redirect blackberry users to my mobile site by doing: #
I'm doing a PHP site which displays code examples in various languages (C#, PHP,
We're looking at doing a MOSS 2007 site which will have a fairly dynamic
I am doing some work on a web site that has a secure area
I want to deploy my site on my web hosting package by doing a
When doing a cvs update , you get a nice summary of the state
I'm developing a CakePHP site for which I've just enabled VAS authentication using a
I am updating an old asp site to cakephp - the old site has
This site is built using CakePHP 1.2* I have an element that needs to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.