All pastes #196491 Raw Edit

Something

public php v1 · immutable
·published 2006-10-10 17:21 UTC
rendered paste body
<?php// Host settings$host = $_GET['h'];$port = $_GET['p'];$fp=@fsockopen($host,$port,&$errno,&$errstr,10);if (!$fp) {echo "unable to connect to radio";} else {fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");for($i=0; $i<1; $i++) {if(feof($fp)) break;$fp_data=fread($fp,31337);usleep(500000);}$fp_data=ereg_replace("^.*<body>","",$fp_data);$fp_data=ereg_replace("</body>.*","",$fp_data);list($current,$status,$peak,$max,$reported,$bit,$song) = explode(",",$fp_data, 7);if ($status == "1") {$online = "Currently Online";//echo "$host:$port -> $current/$max listening to $song @ $bit kbit/s";$bandwidth = round($bit / 8 * $current / 1024,2); $bandwidthKB = round($bit / 8 * $current); echo "$current/$max listening to $song and currently streaming at $bit" . "kbit - and using $bandwidthKB" . "KB/s of bandwidth";} else {$online = "Currently Offline";echo "$online ($host:$port)";} }?>