2011-12-14 81 views
2

使用基於Zend FW的Youtube API。在頁面加載經常收到錯誤Zend框架youtube api超時問題

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 503 <errors xmlns='http://schemas.google.com/g/2005'><error> 

或者

Read timed out after 10 second 

Google搜索了一下,發現有用的提醒:超時設置爲180,但它並不能幫助。再一次,這個錯誤發生在不是每次都是,但是經常是

$yt = new Zend_Gdata_YouTube(); 
$yt->getHttpClient()->setConfig(array('timeout'=>180)); 

如何處理該問題?

回答

1

503服務不可用

服務器目前無法處理該請求,由於服務器的 暫時超載或維護。其含義是 ,這是一個暫時的情況,延遲一段時間後將會緩解。如果已知,延遲的長度可以在 Retry-After標題中指示。如果沒有給出Retry-After,那麼客戶端應該處理響應,就像處理500響應一樣。

Note: The existence of the 503 status code does not imply that a 
    server must use it when becoming overloaded. Some servers may wish 
    to simply refuse the connection. 

但真正的原因可能是別的東西,如配置錯誤。 P.S:把你的代碼放在一個試試中,並抓住錯誤。