Google Groups Home
Help | Sign in
Browser Upload Error - Zend_Gdata_App_HttpException
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Caleb Brown  
View profile
 More options May 29, 11:23 am
From: Caleb Brown <calebr...@gmail.com>
Date: Thu, 29 May 2008 08:23:41 -0700 (PDT)
Local: Thurs, May 29 2008 11:23 am
Subject: Browser Upload Error - Zend_Gdata_App_HttpException
Hello, I am currently working on a php browser upload project that
errors out on me every time. I seem to be updating the token so I
don't see where the issue is.

My Code:
session_start();
require_once $_SERVER["DOCUMENT_ROOT"].'/podlab/Zend/Loader.php';

Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$dkey = 'My-Dev-Key';

include 'youtube_functions.php';

youtube_start();

//Request First Token from Youtube
getAuthSubRequestUrl();
echo '<a href="'.getAuthSubRequestUrl().'">'.getAuthSubRequestUrl().'</
a>';

//If they gave me a token...
if($_GET['token']){
//Upgrade the given token
$sessionToken =
Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);

$yt = new Zend_Gdata_YouTube($httpClient);
// create a Zend_Gdata_YouTube_VideoEntry
$myVideoEntry= new Zend_Gdata_YouTube_VideoEntry();

// set up media group as in the example above
$mediaGroup = $yt->newMediaGroup();
$mediaGroup->title = $yt->newMediaTitle()->setText('Video Upload');
$mediaGroup->description = $yt->newMediaDescription()->setText('Video
description');

// note the different schemes for categories and developer tags
$categoryScheme = 'http://gdata.youtube.com/schemas/2007/
categories.cat';
$developerTagScheme = 'http://gdata.youtube.com/schemas/2007/
developertags.cat';

$mediaGroup->category = array(
    $yt->newMediaCategory()->setText('Comedy')-

>setScheme($categoryScheme),

    );

$mediaGroup->keywords = $yt->newMediaKeywords()->setText('cars,
funny');
$myVideoEntry->mediaGroup = $mediaGroup;

$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://apollo.cup.edu/podlab/newtest.php';

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

}

The Error:
Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with
message 'Expected response code 200, got 401' in /Volumes/Aries_2/
webserver/podlab/Zend/Gdata/App.php:468 Stack trace: #0 /Volumes/
Aries_2/webserver/podlab/Zend/Gdata/YouTube.php(520): Zend_Gdata_App-
>post(Object(Zend_Gdata_YouTube_VideoEntry), 'http://gdata.yo...') #1 /

Volumes/Aries_2/webserver/podlab/newtest.php(100): Zend_Gdata_YouTube-
>getFormUploadToken(Object(Zend_Gdata_YouTube_VideoEntry), 'http://

gdata.yo...') #2 {main} thrown in /Volumes/Aries_2/webserver/podlab/
Zend/Gdata/App.php on line 468

HTTP Response 401 makes me assume I was not correctly authenticated,
any ideas?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Fisher  
View profile
 More options May 30, 5:10 pm
From: Jeff Fisher <jfis...@youtube.com>
Date: Fri, 30 May 2008 14:10:28 -0700 (PDT)
Local: Fri, May 30 2008 5:10 pm
Subject: Re: Browser Upload Error - Zend_Gdata_App_HttpException
Hi,

Can you try catching this exception and then checking the body of the
response?

You can do this by surrounding your code in a try block and adding a
catch similar to:

catch(Zend_Gdata_App_HttpException $exception) {
    echo "Error: " . $exception->getResponse()->getRawBody();

}

Cheers,
-Jeff

On May 29, 8:23 am, Caleb  Brown <calebr...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Caleb Brown  
View profile
 More options Jun 2, 1:44 pm
From: Caleb Brown <calebr...@gmail.com>
Date: Mon, 2 Jun 2008 10:44:11 -0700 (PDT)
Local: Mon, Jun 2 2008 1:44 pm
Subject: Re: Browser Upload Error - Zend_Gdata_App_HttpException
The error I receive from the try block is

"Error: b5
User authentication required.
Error 401
0"

Yet, youtube is properly sending a token every time, and I was pretty
sure I was upgrading the token correctly.  Let me know if you have any
ideas.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeff Fisher  
View profile
 More options Jun 2, 2:43 pm
From: Jeff Fisher <jfis...@youtube.com>
Date: Mon, 2 Jun 2008 11:43:38 -0700 (PDT)
Local: Mon, Jun 2 2008 2:43 pm
Subject: Re: Browser Upload Error - Zend_Gdata_App_HttpException
Hi,

There seems to be some bits of code missing since at the point of this
line:

$yt = new Zend_Gdata_YouTube($httpClient);

I don't see where $httpClient has been defined or where you use
$sessionToken after upgrading the token from the server. I'd expect
something like

$httpClient = Zend_Gdata_AuthSub::getHttpClient($sessionToken);
$httpClient->setHeaders('X-GData-Key', "key=${developerKey}");

Cheers,
-Jeff

On Jun 2, 10:44 am, Caleb  Brown <calebr...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert  
View profile
 More options Jun 2, 2:54 pm
From: "Robert" <b...@rcassidy.com>
Date: Mon, 2 Jun 2008 11:54:40 -0700
Local: Mon, Jun 2 2008 2:54 pm
Subject: RE: Browser Upload Error - Zend_Gdata_App_HttpException
Jeff,
  Thanks for responding to my questions.  How do I unsubscribe to this
list.  
bob

Robert Cassidy, CEO
R Cassidy Seminars Management/Amedco
PO Box 14473, Santa Rosa, CA 95402
888 992-9199
fax 707 566-7474

No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.524 / Virus Database: 269.24.1/1470 - Release Date:
5/28/2008 7:20 AM

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jochen Hartmann  
View profile
 More options Jun 2, 3:13 pm
From: Jochen Hartmann <jhartm...@youtube.com>
Date: Mon, 2 Jun 2008 12:13:02 -0700 (PDT)
Local: Mon, Jun 2 2008 3:13 pm
Subject: Re: Browser Upload Error - Zend_Gdata_App_HttpException
Robert,

Not sure how your message relates to this thread. You can just edit
your membership options to leave a group.
- J

On Jun 2, 2:54 pm, "Robert" <b...@rcassidy.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google