3v4l.org

run code in 300+ PHP versions simultaneously
<center> <?php /* Live SHOUTcast statistics for multiple servers This script is (C) Bell Online Ltd 2012 If you use this script, please leave the copyright notice and link at the bottom of the page or link to mixstream.net somewhere on your website. Feel free to modify it in any other way to suit your needs. Version: v1.1 ## Updates: ## 1.1, Added fclose() */ /* ---------- General configuration ---------- */ $station_name = "Galaxy Radio"; $refresh = "30"; // Page refresh time in seconds. Put 0 for no refresh $timeout = "1"; // Number of seconds before connecton times out - a higher value will slow the page down if any servers are offline /* ----------- Server configuration ---------- */ // Note: dont include http:// // Main server: The song title will be taken from this server $ip[1] = "107.150.2.89"; $port[1] = "8000"; /* ----- No need to edit below this line ----- */ /* ------------------------------------------- */ $servers = count($ip); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <?php if ($refresh != "0") { print "<meta http-equiv=\"refresh\" content=\"$refresh\">\n"; } print "<title>$station_name SHOUTcast Stats</title>\n"; ?> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; margin: 5px; background-color: #fff; } div { background-color: #fef9f2; border: 1px solid #000; padding: 4px; margin-bottom: 5px; width: 450px; } div div { margin: 5px; border: 0; background-color: #fef9f2; margin: 5px; margin-bottom: 0; } h1 { font-size: 22px; color: #000; margin: 2px; } h2 { font-size: 14px; color: #336666; margin: 2px; } p { margin: 5px; } a { color: #666699; text-decoration: none; } a:hover { color: #993333; } div.line { border-bottom: 1px dashed #000; height: 3px; font-size: 1px; margin-top: 0; } div#blu, div#blu div { background-color: #b2bfc0; } .red { color: #CC0000; font-weight: bold; } .small { font-size: 10px; } --> </style> </head> <body> <?php $i = "1"; while($i<=$servers) { $fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout); if (!$fp) { $listeners[$i] = "0"; $msg[$i] = "<span class=\"red\">ERROR [Ο server είναι εκτός λειτουργίας]</span>"; $error[$i] = "1"; } 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('<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>', "", $info); $info = str_replace('</body></html>', "", $info); $stats = explode(',', $info); if (empty($stats[1]) ) { $listeners[$i] = "0"; $msg[$i] = "<span class=\"red\">ERROR [Δεν εκπέμπει κάποιος DJ]</span>"; $error[$i] = "1"; } else { if ($stats[1] == "1") { $song[$i] = $stats[6]; $listeners[$i] = $stats[0]; $max[$i] = $stats[3]; $bitrate[$i] = $stats[5]; $peak[$i] = $stats[2]; if ($stats[0] == $max[$i]) { $msg[$i] .= "<span class=\"red\">"; } $msg[$i] .= "Online στα $bitrate[$i] kbps με $listeners[$i] συνδεδεμένους ακροατές"; if ($stats[0] == $max[$i]) { $msg[$i] .= "</span>"; } //$msg[$i] .= "\n <p><b>Listener peak:</b> $peak[$i]"; } else { $listeners[$i] = "0"; $msg[$i] = " <span class=\"red\">ERROR [Cannot get info from server]</span>"; $error[$i] = "1"; } } } //fclose($fp); $i++; } $total_listeners = array_sum($listeners) ; print "<div>\n <div>\n <p><b>Το τραγούδι που ακούμε:</b> $song[1]</p>\n </div>\n</div>\n<div>\n"; $i = "1"; while($i<=$servers) { print " <div>\n"; if ($max[$i] > 0) { $percentage = round(($listeners[$i] / $max[$i] * 100)); $timesby = (300 / $max[$i]); $barlength = round(($listeners[$i] * "$timesby")); } if ($error[$i] != "1") { ?> <?php } else { ?> <?php } print "<b>Radio:</b> $msg[$i]"; $i++; } $time_difference = "0"; // BST: 1 GMT: 0 $time_difference = ($time_difference * 60 * 60); $time = date("h:ia", time() + $time_difference); $date = date("jS F, Y", time() + 0); ?> <div> </div> </body> </html> </center>
Output for 7.4.0
<center> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="refresh" content="30"> <title>Galaxy Radio SHOUTcast Stats</title> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; margin: 5px; background-color: #fff; } div { background-color: #fef9f2; border: 1px solid #000; padding: 4px; margin-bottom: 5px; width: 450px; } div div { margin: 5px; border: 0; background-color: #fef9f2; margin: 5px; margin-bottom: 0; } h1 { font-size: 22px; color: #000; margin: 2px; } h2 { font-size: 14px; color: #336666; margin: 2px; } p { margin: 5px; } a { color: #666699; text-decoration: none; } a:hover { color: #993333; } div.line { border-bottom: 1px dashed #000; height: 3px; font-size: 1px; margin-top: 0; } div#blu, div#blu div { background-color: #b2bfc0; } .red { color: #CC0000; font-weight: bold; } .small { font-size: 10px; } --> </style> </head> <body> Notice: Undefined variable: song in /in/ehVCg on line 172 Notice: Trying to access array offset on value of type null in /in/ehVCg on line 172 <div> <div> <p><b>Το τραγούδι που ακούμε:</b> </p> </div> </div> <div> <div> Notice: Undefined variable: max in /in/ehVCg on line 177 Notice: Trying to access array offset on value of type null in /in/ehVCg on line 177 <b>Radio:</b> <span class="red">ERROR [Ο server είναι εκτός λειτουργίας]</span><div> </div> </body> </html> </center>
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12
<center> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="refresh" content="30"> <title>Galaxy Radio SHOUTcast Stats</title> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; margin: 5px; background-color: #fff; } div { background-color: #fef9f2; border: 1px solid #000; padding: 4px; margin-bottom: 5px; width: 450px; } div div { margin: 5px; border: 0; background-color: #fef9f2; margin: 5px; margin-bottom: 0; } h1 { font-size: 22px; color: #000; margin: 2px; } h2 { font-size: 14px; color: #336666; margin: 2px; } p { margin: 5px; } a { color: #666699; text-decoration: none; } a:hover { color: #993333; } div.line { border-bottom: 1px dashed #000; height: 3px; font-size: 1px; margin-top: 0; } div#blu, div#blu div { background-color: #b2bfc0; } .red { color: #CC0000; font-weight: bold; } .small { font-size: 10px; } --> </style> </head> <body> Notice: Undefined variable: song in /in/ehVCg on line 172 <div> <div> <p><b>Το τραγούδι που ακούμε:</b> </p> </div> </div> <div> <div> Notice: Undefined variable: max in /in/ehVCg on line 177 <b>Radio:</b> <span class="red">ERROR [Ο server είναι εκτός λειτουργίας]</span><div> </div> </body> </html> </center>
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
<center> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="refresh" content="30"> <title>Galaxy Radio SHOUTcast Stats</title> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; margin: 5px; background-color: #fff; } div { background-color: #fef9f2; border: 1px solid #000; padding: 4px; margin-bottom: 5px; width: 450px; } div div { margin: 5px; border: 0; background-color: #fef9f2; margin: 5px; margin-bottom: 0; } h1 { font-size: 22px; color: #000; margin: 2px; } h2 { font-size: 14px; color: #336666; margin: 2px; } p { margin: 5px; } a { color: #666699; text-decoration: none; } a:hover { color: #993333; } div.line { border-bottom: 1px dashed #000; height: 3px; font-size: 1px; margin-top: 0; } div#blu, div#blu div { background-color: #b2bfc0; } .red { color: #CC0000; font-weight: bold; } .small { font-size: 10px; } --> </style> </head> <body> Notice: Undefined variable: song in /in/ehVCg on line 172 <div> <div> <p><b>Το τραγούδι που ακούμε:</b> </p> </div> </div> <div> <div> Notice: Undefined variable: max in /in/ehVCg on line 177 <b>Radio:</b> <span class="red">ERROR [Ο server είναι εκτός λειτουργίας]</span><div> </div> </body> </html> </center>
Output for 4.3.0 - 4.3.1
<center> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="refresh" content="30"> <title>Galaxy Radio SHOUTcast Stats</title> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #333333; margin: 5px; background-color: #fff; } div { background-color: #fef9f2; border: 1px solid #000; padding: 4px; margin-bottom: 5px; width: 450px; } div div { margin: 5px; border: 0; background-color: #fef9f2; margin: 5px; margin-bottom: 0; } h1 { font-size: 22px; color: #000; margin: 2px; } h2 { font-size: 14px; color: #336666; margin: 2px; } p { margin: 5px; } a { color: #666699; text-decoration: none; } a:hover { color: #993333; } div.line { border-bottom: 1px dashed #000; height: 3px; font-size: 1px; margin-top: 0; } div#blu, div#blu div { background-color: #b2bfc0; } .red { color: #CC0000; font-weight: bold; } .small { font-size: 10px; } --> </style> </head> <body>
Process exited with code 139.

preferences:
206.22 ms | 402 KiB | 250 Q