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 8650033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:42:57+00:00 2026-06-12T13:42:57+00:00

I just can’t seem to get this API working. My eyes are missing the

  • 0

I just can’t seem to get this API working. My eyes are missing the mistakes I’m making. The problem I have is that the page still Shows BLANK.

I need the form to upload the data onto Youtube which will later be displayed on my website.

Here is my code:

<?php
require_once 'library/Zend/Loader/AutoloaderFactory.php'; // the Zend dir must be in    your include_path
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();

Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); 
// start a new session 
session_start();

function getAuthSubRequestUrl()
{
$next = 'http://www.example.com/welcome.php';
$scope = 'http://gdata.youtube.com';
$secure = false;
$session = true;
return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
}


function getAuthSubHttpClient()
{
if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){
    echo '<a href="' . getAuthSubRequestUrl() . '">Login!</a>';
    return;
} else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
  $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
}

$httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
return $httpClient;
}
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$authenticationURL= 'https://www.google.com/accounts/ClientLogin';
$httpClient = 
 Zend_Gdata_ClientLogin::getHttpClient(
          $username = 'myuser@gmail.com',
          $password = 'mypassword',
          $service = 'youtube',
          $client = null,
          $source = 'MySource', // a short string identifying your application
          $loginToken = null,
          $loginCaptcha = null,
          $authenticationURL);
$developerKey = 'ABC123 ... ';
$applicationId = 'Video uploader v1';
$clientId = 'My video upload client - v1';

$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);

// Assuming that $yt is a valid Zend_Gdata_YouTube object
$yt->setMajorProtocolVersion(2);
function getAndPrintVideoFeed($location = Zend_Gdata_YouTube::VIDEO_URI)
{
$yt = new Zend_Gdata_YouTube();
// set the version to 2 to receive a version 2 feed of entries
$yt->setMajorProtocolVersion(2);
$videoFeed = $yt->getVideoFeed($location);
printVideoFeed($videoFeed);
}

function printVideoFeed($videoFeed)
{
$count = 1;
foreach ($videoFeed as $videoEntry) {
echo "Entry # " . $count . "\n";
printVideoEntry($videoEntry);
echo "\n";
$count++;
}
}

// Note that this example creates an unversioned service object.
// You do not need to specify a version number to upload content
// since the upload behavior is the same for all API versions.
$yt = new Zend_Gdata_YouTube($httpClient);

// 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);
$tokenValue = $tokenArray['token'];
$postUrl = $tokenArray['url'];

// place to redirect user after upload
$nextUrl = 'http://www.example.com/youtube_uploads';

// build the form
$form = '<form action="'. $postUrl .'?nexturl='. $nextUrl .
    '" method="post" enctype="multipart/form-data">'. 
    '<input name="file" type="file"/>'. 
    '<input name="token" type="hidden" value="'. $tokenValue .'"/>'.
    '<input value="Upload Video File" type="submit" />'. 
    '</form>';
echo "aaaa".$form;

?> 

  • 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-06-12T13:42:58+00:00Added an answer on June 12, 2026 at 1:42 pm

    Here is my code with Zend

        //include Zend Gdata Libs
    
    require_once("Zend/Gdata/ClientLogin.php");       
    require_once("Zend/Gdata/HttpClient.php");          
    require_once("Zend/Gdata/YouTube.php");          
    require_once("Zend/Gdata/App/HttpException.php");         
    require_once('Zend/Uri/Http.php');
    
    //yt account info
    $yt_user = 'myuser@gmail.com'; //youtube username or gmail account
    $yt_pw = 'mypassword'; //account password
    $yt_source = 'title of my video'; //name of application (can be anything)
    
    //yt dev key  get here : https://code.google.com/apis/youtube/dashboard/
    $yt_api_key = ''ABC123 ... ''; //your youtube developer key
    
    //login in to YT
    $authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
    $httpClient = Zend_Gdata_ClientLogin::getHttpClient(
                                              $username = $yt_user,
                                              $password = $yt_pw,
                                              $service = 'youtube',
                                              $client = null,
                                              $source = $yt_source, // a short string identifying your application
                                              $loginToken = null,
                                              $loginCaptcha = null,
                                              $authenticationURL);
    
    // Note that this example creates an unversioned service object.
    // You do not need to specify a version number to upload content
    // since the upload behavior is the same for all API versions.
    //$yt = new Zend_Gdata_YouTube($httpClient);
    $yt = new Zend_Gdata_YouTube($httpClient, $yt_source, NULL, $yt_api_key);
    

    I can Upload my file and after a while I’m redirected to “$nextUrl”.
    My issue is that I get this page : http://www.example.com/youtube_uploads?statu=400&error=failed
    And I don’t no why.

    Any Idea, please ?

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

Sidebar

Related Questions

i have this simple code i just can't get it working. <html> <head> <script
I just can't seem to get this working its been weeks I've been trying.
I just can't seem to get localization to work. I have a class library.
I just can't get this right. I have a slider to increase my JPanel's
I just can't figure this out. I have a script that gets data from
I just can't seem to figure this out - I'm trying to get the
I just can't seem to get this query figured out. I need to combine
Pretty simple problem but I just can't seem to configure this correctly. I would
Just can't seem to get this happening ! $(.fancy).click(function(event) { event.preventDefault(); var pic =
I just can't seem to wrap my mind around this concept... I want 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.