Project

General

Profile

Actions

Task #34885

closed

t3lib_div::getURL add Timeout

Added by Christopher Seidel over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2012-03-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
Tags:
Complexity:
Sprint Focus:

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

Actions #1

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

Actions #2

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?

Actions #3

Updated by Christopher Seidel over 12 years ago

Yes it resolves the problem ;)

Thanks so far for your help

Actions #4

Updated by Georg Ringer over 12 years ago

  • Status changed from Needs Feedback to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF