Noizz.be
Legacy Member
Hey
Op onze website http://radio.rootspirit.com heb je een topframe'pje die de status van onze radio weergeeft
In internet explorer en in firefox ziet dat er goed uit.
Maar iemand anders, die linux gebruikt, krijgt grote spaties tussen de regels:
http://www.tuinslak.be/radio.png
Hoe kan ik dat oplossen?
Hoe het eruit ziet:
gegenereert door hetvolgende PHP scriptje:
Alvast bedankt voor de hulp
Greetz
Noizz
Op onze website http://radio.rootspirit.com heb je een topframe'pje die de status van onze radio weergeeft
In internet explorer en in firefox ziet dat er goed uit.
Maar iemand anders, die linux gebruikt, krijgt grote spaties tussen de regels:
http://www.tuinslak.be/radio.png
Hoe kan ik dat oplossen?
Hoe het eruit ziet:
Code:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100"><span style="color:#142C55">Stream Title: </span></td>
<td>Rootspirit Radio ( 24/7 Live Recorded Dance Sets )</td>
</tr>
<tr>
<td width="100"><span style="color:#142C55">Stream Genre: </span></td>
<td>Dance Groove Electric Trance Techno Hardstyle Jump</td>
</tr>
<tr>
<td width="100"><span style="color:#142C55">Current Song: </span></td>
<td>Orion - Realbeatz</td>
</tr>
</table>
gegenereert door hetvolgende PHP scriptje:
PHP:
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
error_reporting(E_ALL);
class Radio
{
var $fields;
var $very_first_str;
function Radio($array=array())
{
$this->setFields($array);
$this->setOffset("Current Stream Information");
}
function setFields($array){$this->fields = $array;}
function setOffset($string){$this->very_first_str = $string;}
function getData($url, $port, $display_array=null, $very_first_str=null)
{
if (!isset($display_array))
$display_array = $this->fields;
if (!isset($very_first_str))
$very_first_str = $this->very_first_str;
$domain = (substr($url, 0, 7) == "http://") ? substr($url, 7) : $url;
// opening a connection and reading the contents
if (@$fp = fsockopen($domain, $port, $errno, $errstr, 2))
{
$contents = "";
fputs($fp, "GET / HTTP/1.1\r\n".
"User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n".
"Host: ".$domain."\r\n\r\n");
while (!feof($fp))
{
$contents .= fgets($fp, 256);
}
fclose ($fp);
// parsing the contents
foreach ($display_array AS $key => $item)
{
$very_first_pos = stripos($contents, $very_first_str);
$first_pos = stripos($contents, $item, $very_first_pos);
$line_start = strpos($contents, "<td>", $first_pos);
$line_end = strpos($contents, "</td>", $line_start) + 4;
$difference = $line_end - $line_start;
$line = substr($contents, $line_start, $difference);
$data[$key] = strip_tags($line);
}
return $data;
}
else
{
return $errstr." (".$errno.")";
}
}
}
if (!function_exists("stripos"))
{
function stripos($haystack, $needle, $offset=0)
{
return strpos(strtoupper($haystack), strtoupper($needle), $offset);
}
}
/******
* $display_array determines the data that will be displayed
* ==============
* Posibilities:
* --------------
* - Server Status
* - Stream Status
* - Listener Peak
* - Average Listen Time
* - Stream Title
* - Content Type
* - Stream Genre
* - Stream URL
* - Stream AIM
* - Stream IRC
* - Current Song
***/
$display_array = array("Stream Title", "Stream Genre", "Current Song");
$radio = new Radio($display_array);
$data_array = $radio->getData("http://217.170.21.153", 8000);
if (is_array($data_array))
{
foreach ($display_array AS $i => $text)
{
$datastring = $data_array[$i];
echo "<tr>";
echo "<td width=\"100\"><span style=\"color:#142C55\">".$text.": </span></td>";
echo "<td>".$datastring."</td>";
echo "</tr>";
}
}
else
{
echo $data_array;
}
?>
</table>
Alvast bedankt voor de hulp
Greetz
Noizz