Zend_Http_客户端超时
嘿,我正在使用Zend_Http_客户端超时,http,zend-framework,Http,Zend Framework,嘿,我正在使用Zend_Http_Client调用服务器中的php服务,但我遇到了一个与超时相关的异常: 2012-05-30T13:47:26+02:00 INFO(6): LeomobileMdcms: Requesting callback url (http://######.nurago.com/mobileRedirect.php?resp=NRGH&annotations=) while updating (356812045426135) of device with
Zend_Http_Client
调用服务器中的php服务,但我遇到了一个与超时相关的异常:
2012-05-30T13:47:26+02:00 INFO(6): LeomobileMdcms: Requesting callback url (http://######.nurago.com/mobileRedirect.php?resp=NRGH&annotations=) while updating (356812045426135) of device with token (BtPhP), in LeomobileMdcms_UserInformationController::registerdeviceAction
2012-05-30T13:47:41+02:00 ERR(3): LeomobileMdcms: Exception throwed: Unable to Connect to tcp://########.nurago.com:80. Error #110: Connection timed out, in LeomobileMdcms_UserInformationController::registerdeviceAction
此代码段负责调用回调URL:
$client = new Zend_Http_Client($receivedSmsUrl);
$client->setConfig(array("timeout"=>5));
try {
$this->log("Requesting callback url ($receivedSmsUrl) while updating "
."IMEI ($address) of device with token ($token), in ".__METHOD__,
Zend_Log::INFO);
$response = $client->request();
if ($response->isError()) {
$this->log("Request failed. Server reply: ".$response->getStatus()
." ".$response->getMessage(),
Zend_Log::WARN);
}
} catch(Zend_Http_Client_Exception $e) {
$this->log("Exception throwed: ".$e->getMessage().", in ".__METHOD__,
Zend_Log::ERR);
}
我认为这是一个防火墙问题,但不幸的是,它与防火墙无关
有人能帮上忙吗?将适配器从套接字(默认)更改为Curl。这应该可以解决这个问题:
$client = new Zend_Http_Client();
$client->setAdapter('Zend_Http_Client_Adapter_Curl');
也许您可以详细说明Op为什么应该使用Zend_Http_Client_Adapter_Curl?至少链接到一个资源来解释它。它帮助了我,当我面对同样的问题时,它拯救了我的一天。