t3lib_div::getURL add Timeout
is it possible to add to the t3lib_div::getURL function a timeout parameter?
Today the url i tried to fetch was not available and TYPO3 tries to load for about a minute until the page was rendered
#1 Updated by Philipp Gampe over 7 years ago
You can use t3lib_http_request for that. It uses HTTP_Request2 for this and just adds some TYPO3 defaults to it.
In addition the next version (4.7) will have a download method too.
$request = t3lib_div::make_instance('t3lib_http_request', $url, 'GET', array("connect_timeout" => $timeout)); $response = $request->send(); $content = $response->getBody();
#2 Updated by Oliver Hader over 7 years ago
- Status changed from New to Needs Feedback
As it already was pointed out (and since you're manually triggering the HTTP request), you could use HTTP_Request2 instead.
Besides that, you could define in the Install Tool, that cURL shall be used with the accordant timeout setting $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlTimeout']
I guess that should resolve your problem, doesn't it?