嘿我正在使用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
此代码段负责调用callback-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);
}
我认为这是防火墙问题,但不幸的是它与防火墙无关。
请帮助一下吗?
答案 0 :(得分:1)
将适配器从套接字(默认)更改为Curl。这应解决问题:
$client = new Zend_Http_Client();
$client->setAdapter('Zend_Http_Client_Adapter_Curl');