Http Client (Timeout)

Robust

Well-known member
Code:
An exception occurred: Unable to Connect to ssl://www.apantic.com:443. Error #110: Connection timed out in /home/vagrant/apantic/dev1/library/Zend/Http/Client/Adapter/Socket.php on line 235

I get that error if apantic.com is ever down or if XF is unable to connect. I checked XenForo_Helper_Http and there are a bunch of 'safe' options, but none to say if you can't connect 5 times just return null or whatever. Instead it returns a XF error.

Is there any way to set a maxtries and in which case it returns false or null or something?
 
Code:
An exception occurred: Unable to Connect to ssl://www.apantic.com:443. Error #110: Connection timed out in /home/vagrant/apantic/dev1/library/Zend/Http/Client/Adapter/Socket.php on line 235

I get that error if apantic.com is ever down or if XF is unable to connect. I checked XenForo_Helper_Http and there are a bunch of 'safe' options, but none to say if you can't connect 5 times just return null or whatever. Instead it returns a XF error.

Is there any way to set a maxtries and in which case it returns false or null or something?

You can wrap it in a try and catch any exceptions and handle it from there
 
You can wrap it in a try and catch any exceptions and handle it from there
Could try that. Might have a timeout but still a good idea.

Zend_Http_Client_Exception
That's the exception it'd call if it had problems, right?
 
Could try that. Might have a timeout but still a good idea.

Zend_Http_Client_Exception
That's the exception it'd call if it had problems, right?

Probably, but it might be a good idea to have it catch all exceptions just to prevent potential page breaking. Iirc you can pass a timeout to it as well, don't remember how though, I can look later if you don't figure it out. On mobile now
 
Back
Top Bottom