Archive for category Programming
PHP: file_get_contents timeout
by someone16 on Oct.30, 2009, under Programming
How to set timeout when fetching content from web site with file_get_contents?
It's a good idea to use it with timeout, because otherwise default timeout from php.ini will be used.
Leave a Comment
:php
more...
<?php
$context = stream_context_create(array('http' => array('timeout' > 1)));
echo file_get_contents("http://example.com/", 0, $context);
?>
It's a good idea to use it with timeout, because otherwise default timeout from php.ini will be used.