Hmm i have a fopen script going to a remote server to pick up which song is being played in a radiostation…
The problem is that when the remote server is down due to internet provice problems the radio station webpage works with finding the remote file for a long time and finally return a long error message…
heres the script…
[php]
</head>
<body>
<script type="text/javascript">
setTimeout(function() {Ajax();}, 10000);
</script>
<div id="ReloadThis">
<?php
$file = fopen ("http://xxx.xxxx.xxx/onair.wsx", "r");
$inn = fread($file, 200000);
preg_match_all("/(.*?)<\/titleName>/ei", $inn, $Matches);
$tittel = $Matches[0][0];
$nytittel = $Matches[0][1];
preg_match_all("/(.*?)<\/artistName>/ei", $inn, $Matches);
$artist = $Matches[0][0];
$nyartist = $Matches[0][1];
echo " Spilles Nå: $artist - $tittel";
?>
[/php]
as you see i have a javascript to autoupdate…
is there anyway i can get this to output a simple text if the server is down or unreachable??? to smooth down the pageload of the radio website???