RaythMistwalker Posted April 2, 2010 Share Posted April 2, 2010 <? require("../config.php"); ini_set('display_errors', 'on'); error_reporting(E_ALL); $link = mysql_connect(DB_HOST, SAM_DB_USER, SAM_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(SAM_DB_USER); if(!$db) { die("Unable to select database"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>.::RadioLightning::. Home</title> <link href="red.css" rel="stylesheet" type="text/css" /> </head> <body text="#0000ff" link="#00a5e9" vlink="#00a5e9" alink="#00a5e9" leftmargin="2" topmargin="2" marginwidth="2" marginheight="0"> <center><h1>RadioLightning</h1></center> <table width=100% class='tableborder'><tr><td valign=top width=27%><div class='titlemedium'>Links</div><br> <a href='index.php'>Home</a><br> <a href='playlist.php'>AutoDJ Playlist</a><br> <a href='request.php'>Request a Song</a><br> <a href='chat.php'>Chat Client</a><br> </td><td width=73%> <div class='maintitle'><center>Welcome</center></div><br> Welcome to RadioLightning. <br><br><div class='maintitle'><center>Live Info</center></div><br> <?php $ip = "stream.radiolightning.co.cc"; $port = "9258"; $fp = @fsockopen($ip,$port,$errno,$errstr,1); if (!$fp) { $title = "Connection timed out or the server is offline "; } else { fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n"); while (!feof($fp)) { $info = fgets($fp); } $info = str_replace('</body></html>', "", $info); $split = explode(',', $info); if (empty($split[6]) ) { $title = "The current song is not available "; } else { $count = count($split); $i = "6"; while($i<=$count) { if ($i > 6) { $title .= ", " . $split[$i]; } else { $title .= $split[$i]; } $i++; } } } $title = substr($title, 0, -2); echo "Current Song: ".$title; if (!$fp) { $listeners = "0"; } else { fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n"); while (!feof($fp)) { $info = fgets($fp); } $split = explode(',', $info); if ($split[1] == "0" ) { $listeners = "0"; } else { $listeners = $split[0]; } } echo "<br>Number of Listeners: ".$listeners; ?> <?php // Change these to your online/offline messages // $online = "<img src='images/online.gif'>Online"; // Displays when stream is online $offline = "<img src='images/offline.gif'>Offline"; // Displays when stream is offline // don't edit below // $ip = "stream.radiolightning.co.cc"; $port = "9258"; $fp = @fsockopen($ip,$port,$errno,$errstr,1); if (!$fp) { $status = $offline; } else { fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n"); while (!feof($fp)) { $info = fgets($fp); } $split = explode(',', $info); if ($split[1] == "0" ) { $status = $offline; } else { $status = $online; } } echo "<br>Status: ".$status; ?> <td></tr></table> <div class='copyright'>Copyright to RadioLightning.Co.Cc</div> </body> </html> Ok this is the home page of my radio website and for some reason it isn't getting the stream song title or number of listeners. It seems the connection is timing out. Any help on this? Link to comment https://forums.phpfreaks.com/topic/197366-shoutcast-info/ Share on other sites More sharing options...
monkeytooth Posted April 2, 2010 Share Posted April 2, 2010 What exactly is the error being output? That can better help us try to track down the flaw in the code. Also if the error output has a "Line: #" tell us what that line is. Thank you Link to comment https://forums.phpfreaks.com/topic/197366-shoutcast-info/#findComment-1036063 Share on other sites More sharing options...
RaythMistwalker Posted April 3, 2010 Author Share Posted April 3, 2010 it is literally just saying connection timed out or server is offline. as the server is mine i know for a fact it isnt offline so im thinking maybe its taking too long for it to get the info. Link to comment https://forums.phpfreaks.com/topic/197366-shoutcast-info/#findComment-1036468 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.