Zend_Uri_Exception düzeltmek için nasıl (PHP Zend GData YouTube API)

1 Cevap php

Ben bir PHP komut dosyası YouTube API için Zend GData kullanıyorum. Aslında bu çalışma ince vardı ve aniden mesajın 'Geçersiz URI verilen' ile 'Zend_Uri_Exception' hakkında ölümcül bir hata alıyorum. Ben nasıl istisna düzeltebilirsiniz?

KOD:

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;
}

ÇIKIŞ:

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}

1 Cevap

I just tried on link text

Ve bu açık saçık 2. sürümünde yetkili değil gibi görünüyor

<errors xmlns='http://schemas.google.com/g/2005'>
<error>
<domain>GData</domain>
<code>InvalidRequestUriException</code>
<internalReason>Parameter racy not available in version 2</internalReason>  
</error>
</errors>

Istek

GET /feeds/api/videos?q=Comedy%2Bdog&safeSearch=none&racy=include
GData-Version: 2

X-GData-Client: ytapi-google-jsdemo

Content-Type: application/atom+xml

Cache-Control: no-cache

Açık saçık denetimini kaldırmak veya farklı bir versiyonunu ayarlamak için deneyin

GET /feeds/api/videos?q=Comedy%2Bdog&search=none&racy=include

Bu bir çalışıyor