The developer key can be passed in to the Zend_Gdata_YouTube
constructor, like
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId,
$developerKey);
Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev
On Apr 16, 4:46 am, "adeless...@gmail.com" <adeless...@gmail.com>
wrote:
> Hello,
> I have the same problem. I have a developper key but I don t know how to
> use it in my php script.
> Could you help me please.
> Here is my script
>
> <?php
> require_once 'Zend/Loader.php';
> Zend_Loader::loadClass('Zend_Gdata_YouTube');
> Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
> Zend_Loader::loadClass('Zend_Gdata_Calendar');
>
> $serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined
> service name ('cl') for calendar
> $applicationName = 'app';
>
> // Create an authenticated HTTP client
> //$httpClient =
> Zend_Gdata_ClientLogin::getHttpClient('adeless...@gmail.com', 'v1cp1tdd',
> 'youtube' , null, $applicationName);
> $authenticationURL= 'https://www.google.com/youtube/accounts/ClientLogin';
> $httpClient = Zend_Gdata_ClientLogin::getHttpClient(
> $username
> ='adxxxxxx...@gmail.com',
> $password = 'xxxxx',
> $service = 'youtube',
> $client = null,
> $source = 'MySource', // ashort
> string identifying your application
> $loginToken = null,
> $loginCaptcha = null,
> $authenticationURL);
>
> $yt = new Zend_Gdata_YouTube($httpClient);
> echo aa;
> $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
>
> $filesource = $yt->newMediaFileSource('IMG_0198.MOV');
> $filesource->setContentType('video/quicktime');
> $filesource->setSlug('mytestmovie.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('cars, funny');
>
> // Optionally set some developer tags
> $myVideoEntry->setVideoDeveloperTags(array('mydevelopertag',
> 'anotherdevelopertag'));
>
> // Optionally set the video's location
> $yt->registerPackage('Zend_Gdata_Geo');
> $yt->registerPackage('Zend_Gdata_Geo_Extension');
> $where = $yt->newGeoRssWhere();
> $position = $yt->newGmlPos('37.0 -122.0');
> $where->point = $yt->newGmlPoint($position);
> $myVideoEntry->setWhere($where);
>
> // Upload URI for the currently authenticated user
> $uploadUrl =
> 'http://uploads.gdata.youtube.com/feeds/users/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->getMessage();
> } catch (Zend_Gdata_App_Exception $e) {
> echo $e->getMessage();
> }
>
> ?>
>
>
>
>
>
>
>
> On Tuesday, March 22, 2011 6:26:07 PM UTC+1, Jeffrey Posnick wrote:
>
> > Hello Paul,
>
> > I don't believe that you have entered a developer key into the sample
> > code, so no developer key is being sent along with your request. You
> > can register for a developer key at
>
> > http://code.google.com/apis/youtube/dashboard/gwt/index.html
>
> > and then check the source code that you're using for the appropriate
> > place to enter it.
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > ~ YouTube is hiring! ~http://google.com/jobs/workyoutube~
>
> > On Mar 20, 4:28 pm, PaulBruggers9809 <paul_bruni...@hotmail.com>
> > wrote:
> > > Hi, I'm attempting to upload a video using the Youtube demo application
> > > (Just to check how it works). First of all the authentication part was
> > > successful and I then clicked on the link to upload video. After this I
> > then
> > > entered the criteria such as title and desc and then clicked the GO
> > button.
> > > (Everything else seems to work fine other than the authenticated parts.)
>
> > >http://loughboroughtennis.co.uk/ZendGdata-1.11.4/demos/Zend/Gdata/You...
>
> > > This caused the following error to occur:
>
> > > ERROR Expected response code 200, got 403Invalid format for header
> > > X-GData-Key
>
> > > I'm not sure what this means and how to resolve this so any help would
> > be
> > > greatly appreciated
>
> > > Thanks in advance,
>
> > > Paul
--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment