Search code examples
phpapizend-frameworkyoutubegdata

How to change the request URL from Zend_Gdata_Youtube to actually work on API v3?


I think this may sound weird, but I have an entire web application using Zend Framework connecting to Youtube's former API. The thing is that I have a bunch of code, a lot of things working on this code, and it seems that Zend is not updating this so I could use API 3.

I found the error, it is because the file youtube.php is using this URLS:

const USER_URI = 'https://gdata.youtube.com/feeds/api/users';
    const VIDEO_URI = 'https://gdata.youtube.com/feeds/api/videos';
    const PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist';
    const USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads';
    const USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists';
    const USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions';
    const USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts';
    const USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites';
    const VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses';
    const VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings';
    const VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints';
    const ACTIVITY_FEED_URI = 'https://gdata.youtube.com/feeds/api/events';
    const FRIEND_ACTIVITY_FEED_URI =
        'https://gdata.youtube.com/feeds/api/users/default/friendsactivity';

I think this should be changed to the new request URL, but I think this is happening in the whole code and I don't know how to change things so I can actually work with the new API.

The error I'm getting is:

PHP Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 410 No longer available' in C:...


Solution

  • See the readme on the repo's page:

    This component is unmaintained. If you require API access to the Google api, please consider using https://code.google.com/p/google-api-php-client/