2012-05-30 27 views
2

嘿,我使用Zend_Http_Client調用服務器中的PHP服務,但我得到了與時間相關的一個異常:一個Zend_Http_Client超時

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); 
} 

我在想它是一個防火牆問題,但不幸的是它與防火牆無關。

請問能有人幫忙嗎?

回答

1

將您的適配器從套接字(默認)更改爲Curl。這應該可以解決問題:

$client = new Zend_Http_Client(); 
$client->setAdapter('Zend_Http_Client_Adapter_Curl'); 
+1

也許你可以詳細說明爲什麼操作應該使用Zend_Http_Client_Adapter_Curl?至少可以鏈接到解釋它的資源。 –

+0

它幫助了我,當我面臨同樣的問題 –

+0

它拯救了我的一天。 –