2011-12-14 40 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:把你的代码放在一个试试中,并抓住错误。