Organizational Research By

Surprising Reserch Topic

php file get contents ignoring timeout using -'php,file-get-contents,connection-timeout'


php file get contents ignoring timeout  using -'php,file-get-contents,connection-timeout'

$url = 'http://a.url/i-know-is-down';

//ini_set('default_socket_timeout', 5);

$ctx = stream_context_create(array(
    'http' => array(
        'timeout' => 5,
        'ignore_errors' => true
        )
    )
);

$start = microtime(true);
$content = @file_get_contents($url, false, $ctx);
$end = microtime(true);
echo $end - $start, "\n";


the response I get is generally 21.232 segs, shouldn't be about five seconds???

Uncommenting the ini_set line don't help at all.
    
asked Sep 8, 2015 by rajesh
0 votes
9 views



Related Hot Questions



Government Jobs Opening


...