Task #34885
closedt3lib_div::getURL add Timeout
100%
Description
Hi,
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
Updated by Philipp Gampe over 12 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();
Documentation is at:
http://wiki.typo3.org/T3lib_http_Request
http://pear.php.net/manual/en/package.http.http-request2.config.php
Updated by Oliver Hader over 12 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?
Updated by Christopher Seidel over 12 years ago
Yes it resolves the problem ;)
Thanks so far for your help
Updated by Georg Ringer over 12 years ago
- Status changed from Needs Feedback to Closed
- % Done changed from 0 to 100