I am using a script to get data from a site, this works fine, but when the other site is down the script doesn't do anything.
This is the way I do it:
function getdata($path) {
if (!$file = @fopen ($path, "r")) {
$data = "Can't reach remotehost";
return $data;
}
.. Some code to extract the correct data ..
fclose($file);
return $data;
}
The if should do the job, but it doesn't seem to work.
Is there an other way to check if the remote site can be reached?