i have a site where i pull a file in remotely from another url. for example:
PHP Code:
<?
$array = file("http://somehost/somefile.txt");
foreach($array as $each)
{
echo "$each <br>\n";
}
?>
sometimes it is possible that this remote file will not be available. if it is not available, the code above will cause the page to hang, and then print an error.
i want it to spend 1 second max checking for this file, .. and if it doesn't find it, then print "not available"
what would be the best way to go about this? maybe using curl? is there any other way?