Im opening a file on a remote server using the code below :
$test=file("http://www.securetrading.com/download/currencyrates/curr-gbp-ns-today.txt");
I need to check if the connect to the file failed... any tips...?
Thanks again in advance...
i would try:
$data = array(); $data = @file(...);
$ok = false; foreach($data as $line) { if(trim($line) != "") $ok = true; }
if(!$ok) die("sorry, no data");
so if only one line in $data is not blank, the file is considered as read ok.