Hi guys,
got a problem, using this script to display the current song being played on my radio station :
Code:$ip = $row['IP']; $port = $row['Port']; } //////////////////// // END OF CONFIG AREA // // DO NOT EDIT BELOW // UNLESS YOU KNOW WHAT YOU ARE DOING //////////////////// function getNowPlaying($ip,$port) { $open = fsockopen($ip,$port,$errno,$errstr,'.5'); if ($open) { fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); stream_set_timeout($open,'1'); $read = fread($open,200); $text = explode(",",$read); if($text[6] == '' || $text[6] == '</body></html>'){ $msg = ' live stream '; } else { $msg = $text[6]; } $text = ''.$msg; } else { return false; } fclose($open); return $text; }
now it works fine, how ever if the stations offline it gives the error :
"Warning: fsockopen() [function.fsockopen]: unable to connect to 64.150.181.14:7028 (Connection timed out) in /home/welovera/public_html/player/index.php on line 468"
Does anyone know how i can make it display "ERROR : STATION OFFLINE" instead of the error above?
Thanks,
Jamie.




Reply With Quote