Uploading a video to youtube through api version 3 in PHP
by Robert-Jan de Dreu on
I’ve been trying to get the API from google youtube to work so I can upload video’s to it from my web application. It took me extremely long to figure out how the API worked because of lack of documentation at this moment. That is why I’m writing a blog post about it so people will hopefully have less trouble with it.
Downloading the Google PHP Library
First you need to get the Google PHP API Libary so not the Zend libary. As you can see that libary also has an example. Parts of that example we will use to handle the authentication for us.
Registering your Google API Client and Developer Keys
Now you need to register your client and developer keys. Registering your Client Key can be done at the Google Api Console. Here you can register your client key at “Client ID for web applications” and your developer key at “Simple API Access”. More information can be found at the Google PHP Client OAuth2 Docs
The PHP Code used to Upload a Video to Youtube
The following code is partly from google and Partly written by me trying to figgure out for the google version 3 api is working.
That’s it. I hope you have enough information to get your youtube upload with API version 3 working like it should. If you have questions of some information is lacking feel free to request it in the comments section.