I am trying to use Zend Gdata Library for uploading videos to YouTube. I was trying to test the example provided, but got into a problem running the example. Here was the error:
PHP Fatal error: Call to undefined method Zend_Http_Client::setRawDataStream() in /usr/share/php/Zend/Gdata/App.php on line 661
It was because I had missed the part where I should have sent a Zend_Gdata_HttpClient() object while initializing Zend_Gdata_YouTube() object.
So, here is how I created Zend_Gdata_HttpClient() object and passed it to Zend_Gdata_YouTube() constructor. Also, video upload requires developer key which you can get from Google and username/password.
require_once('Zend/Loader.php'); // the Zend dir must be in your include_path $authenticationURL= 'https://www.google.com/accounts/ClientLogin'; Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); $httpclient = Zend_Gdata_ClientLogin::getHttpClient( $username = $user, $password = $pass, $service = 'youtube', $client = null, $source = 'An App Name', // a short string identifying your application $loginToken = null, $loginCaptcha = null, $authenticationURL ); Zend_Loader::loadClass('Zend_Gdata_YouTube'); $yt = new Zend_Gdata_YouTube($httpclient,"An App Name","Version something or some desc","API-KEY");
Hope this helps.