Why doesn't the following code time out when it's taking 5-10 seconds for the URL to be retrieved?
set_time_limit(2);
$f = file("http://www.oglobo.com.br/");
You can also replace the second line with a sleep(10) command and get the same effect of the script not timing out in 2 seconds.