2

嘿,我正在使用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);
}

我认为这是一个防火墙问题,但不幸的是它与防火墙无关。

请问有人可以帮忙吗?

4

1 回答 1

1

将您的适配器从 Socket(默认)更改为 Curl。这应该可以解决问题:

$client = new Zend_Http_Client();
$client->setAdapter('Zend_Http_Client_Adapter_Curl');
于 2015-01-07T11:15:51.837 回答