shoutcast fsockopen

时间:2012-08-31 11:45:58

标签: php xml

shoutcasts脚本还有其他内容可以读取它的XML文件吗?

我目前有:

<?php
$open = fsockopen("62.75.171.171","9992"); 
if ($open) { 
fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n"); 
$read = fread($open,1000); 
$text = explode("content-type:text/html",$read); 
$text = explode(",",$text[1]); 
} else { $er="Connection Refused!"; } 
?> 
</div> 
<?php 
if ($text[1]==1) { $state = "Up"; } else { $state = "Down"; } 
if ($er) { echo $er; exit; } 
echo "<font face=verdana size=1> 
Listeners: $text[0] of $text[3] ($text[4] Unique)<br> 
Listener Peak: $text[2]<br> 
Server State: <b>$state</b><br> 
Bitrate: $text[5] Kbps<br> 
Current Song: $text[6]
Current DJ: $text[13]
</font>";?> 
<?php
echo "<IMG src='http://thepilotslife.com/images/shows/{$text[13]}.png'></img>";
?>

但是给了我这些错误:

Notice: Undefined variable: er in C:\xampp\htdocs\stats.php on line 13

Notice: Undefined offset: 13 in C:\xampp\htdocs\stats.php on line 20
Listeners: 0 of 150 (0 Unique)
Listener Peak: 1
Server State: Up
Bitrate: 128 Kbps
Current Song: Swedish House Mafia - Greyhound Current DJ: 
Notice: Undefined offset: 13 in C:\xampp\htdocs\stats.php on line 23

我做错了什么,还有其他方法可以做到这一点,因为fsockopen被大多数主机阻止。

0 个答案:

没有答案