Zend_Http_Client Hangs when trying to request an invalid URL

I use Zend_Http_Client to request a URL, the HTTP client has a timeout of 10.

 $config = array( 'adapter' => 'Zend_Http_Client_Adapter_Curl', 'curloptions' => array( CURLOPT_USERAGENT => 'Zend_Curl_Adapter', CURLOPT_HEADER => 0, CURLOPT_VERBOSE => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_TIMEOUT => 10, CURLOPT_SSL_VERIFYPEER => false, ), ); 

For testing, I also added a set time limit to try to stop it from freezing:

 set_time_limit(10); try { $client->request($method); } catch (Zend_Http_Client_Exception $e) { // ... } 

The request just hangs, so I can not get the response object, and there will be no exceptions / deaths. Has anyone had this problem before?

+4
source share
1 answer

Have you tried to add the parameter CURLOPT_CONNECTTIMEOUT ?

0
source

All Articles