Ciao!
sto cercando di far partire un Now Playing per la nostra webradio che ha attualmente due server che possono andare.
Quello che sto cercando di fare è interrogare prima il primo server, e se quello non è attivo, interrogare il secondo che invece è sempre attivo.
vi allego lo script che ho trovato su internet e che funziona per, appunto, un solo server.
come si fare un If/Else?codice:<?php include("icecast.current.class.php"); $icecast = new icecast(); $icecast->host = "stream.lanostraradio.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 "Su Radio Gwen strimpella: "; echo $icecast->GetCurrent(); } else { echo "Non suona niente"; } ?>
grazie!

Rispondi quotando