I am using Zend Gdata to interface with the YouTube API from a PHP script. I actually had this working fine, and suddenly I am getting a fatal error about a 'Zend_Uri_Exception' with message 'Invalid URI supplied'. How can I correct the exception?
CODE:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();
$query = $yt->newVideoQuery();
$query->setOrderBy($this->data['ItemVideo']['sort']);
$query->setRacy('include');
$query->setCategory($this->data['ItemVideo']['q']);
try {
$videoFeed = $yt->getVideoFeed($query);
} catch(Exception $e) {
echo var_dump($query) . '<p></p>' . $e;
}
OUTPUT:
object(Zend_Gdata_YouTube_VideoQuery)#79 (4) { ["_params:protected"]
=> array(2) { ["orderby"]=> string(9) "relevance" ["racy"]=> string
(7) "include" } ["_defaultFeedUri:protected"]=> NULL
["_url:protected"]=> NULL ["_category:protected"]=> string(14)
"charlie bit me" }
exception 'Zend_Uri_Exception' with message 'Invalid URI supplied' in /
web/php/balistik_list_app/app/vendors/ZendGdata/library/Zend/Uri/
Http.php:136 Stack trace: #0 /web/php/balistik_list_app/app/vendors/
ZendGdata/library/Zend/Uri.php(123): Zend_Uri_Http->__construct
('http', '//gdata.youtube...') #1 /web/php/balistik_list_app/app/
vendors/ZendGdata/library/Zend/Http/Client.php(257): Zend_Uri::factory
('http://gdata.yo...') #2 /web/php/balistik_list_app/app/vendors/
ZendGdata/library/Zend/Gdata/App.php(476): Zend_Http_Client->setUri
('http://gdata.yo...') #3 /web/php/balistik_list_app/app/vendors/
ZendGdata/library/Zend/Gdata.php(203): Zend_Gdata_App-
>performHttpRequest('GET', 'http://gdata.yo...', Array, NULL, NULL,
NULL) #4 /web/php/balistik_list_app/app/vendors/ZendGdata/library/Zend/
Gdata/App.php(610): Zend_Gdata->performHttpRequest('GET', 'http://
gdata.yo...') #5 /web/php/balistik_list_app/app/vendors/ZendGdata/
library/Zend/Gdata/App.php(541): Zend_Gdata_App->get('http://
gdata.yo...') #6 /web/php/balistik_list_app/app/vendors/ZendGdata/
library/Zend/Gdata/App.php(147): Zend_Gdata_App->importUrl('http://
gdata.yo...', 'Zend_Gdata_YouT...') #7 /web/php/balistik_list_app/app/
vendors/ZendGdata/library/Zend/Gdata.php(148): Zend_Gdata_App->getFeed
('http://gdata.yo...', 'Zend_Gdata_YouT...') #8 /web/php/
balistik_list_app/app/vendors/ZendGdata/library/Zend/Gdata/YouTube.php
(171): Zend_Gdata->getFeed('http://gdata.yo...', 'Zend_Gdata_YouT...')
#9 /web/php/balistik_list_app/app/controllers/
item_videos_controller.php(35): Zend_Gdata_YouTube->getVideoFeed(Object
(Zend_Gdata_YouTube_VideoQuery)) #10 /web/php/balistik_list_app/cake/
libs/object.php(114): ItemVideosController->search() #11 /web/php/
balistik_list_app/cake/dispatcher.php(259): Object->dispatchMethod
('search', Array) #12 /web/php/balistik_list_app/cake/dispatcher.php
(213): Dispatcher->_invoke(Object(ItemVideosController), Array) #13 /
web/php/balistik_list_app/app/webroot/index.php(90): Dispatcher-
>dispatch(NULL) #14 {main}