io controllerei con fsockopen per vedere se il primo server è online, se lo è imposti le variabili riferite al primo, altrimenti imposti quelle del secondo:
Codice PHP:
<?php
include("icecast.current.class.php");
$icecast = new icecast();
$fp = fsockopen("stream.lanostraradio1.com", 8000, &$errno, &$errstr, 30); //forse 30 secondi sono troppi
if($fp)
{
$icecast->host = "stream.lanostraradio1.com";
$icecast->port = 8000;
$icecast->mount = "mount1";
$icecast->user = "user";
$icecast->passwd = "passwd";
}
else
{
//impostazioni secondo server
$icecast->host = "stream.lanostraradio2.com";
$icecast->port = 8000;
$icecast->mount = "mount1";
$icecast->user = "user";
$icecast->passwd = "passwd";
}
function elapsedtime($seconds) {
if ($seconds > 86400) {
$seconds -= 86400;
return(gmdate("j\d H:i:s", $seconds));
} else
return(gmdate("H:i:s", $seconds));
}
if ($icecast->openstats()) {
// We got the XML, gogogo!..
echo "[b]Su Radio Gwen strimpella:[/b]
";
echo $icecast->GetCurrent();
}
else {
echo "Non suona niente";
}
?>