0
我需要一些帮助理解和可能解决问题与PHP文件,此文件是旧的whmsonic模板的一部分,是不可用更多的下载,我有一个新鲜的安装,但即使有它也没有解决方案。错误与XML语法 - 未捕获异常'异常'
这是文件
<?php
include("language/en.php");
include('config_radio.php');
$ctx = stream_context_create(array(
'http' => array(
'timeout' => 10
)
)
);
@ini_set('user_agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 WHMSonic/2.0.1');
\t $d = @file_get_contents("http://".$GLOBALS['scip'] . ":" . $GLOBALS['scport'] . "/admin.cgi?mode=viewxml&pass=" . $GLOBALS['scpass'], 10, $GLOBALS['ctx']);
if (!$d) {
echo "<font color=66CCFF><b>$GLOBALS[lang9]<br>$GLOBALS[lang8]</b></font>"; exit; } else {
\t $shoutcast_xml = new SimpleXMLElement($d);
\t $bitrate = utf8_decode($shoutcast_xml->BITRATE);
\t $streamstatus = utf8_decode($shoutcast_xml->STREAMSTATUS);
\t $currentlisteners = utf8_decode($shoutcast_xml->CURRENTLISTENERS);
\t $servertitle = utf8_decode($shoutcast_xml->SERVERTITLE);
\t $songtitle = utf8_decode($shoutcast_xml->SONGTITLE);
?>
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="25; URL=stats.php">
<link type="text/css" rel="stylesheet" href="template/style2.css">
</head>
<body style="margin:0px;">
<div align="center">
<?php if($streamstatus == "1"){ echo ""; } else { echo "<font color=66CCFF><b>$GLOBALS[lang7]<br>$GLOBALS[lang8]</b></font>"; exit;} ?>
<br>
</div>
<table width="90%" border="0" cellspacing="2" cellpadding="0" align="center">
<tr>
<td width="25%">
<div align="right"><b><font color="#999999"><?php echo $GLOBALS['lang3'];?>:</font></b></div>
</td>
<td width="75%">
<?php echo "<font color=FFFFFF><b>$GLOBALS[servertitle]</b></font>"; ?>
</td>
</tr>
<tr>
<td width="25%">
<div align="right"><b><font color="#999999"><?php echo$GLOBALS['servertitle'];?>:</font></b>
</div>
</td>
<td width="75%">
<?php echo "<font color=FFFFFF><b>$GLOBALS[songtitle]</b></font>"; ?>
</td>
</tr>
<tr>
<td width="25%">
<div align="right"><b><font color="#999999"><?php echo$GLOBALS['lang5'];?>:</font></b></div>
</td>
<td width="75%">
<?php echo "<font color=FFFFFF><b>$GLOBALS[bitrate] KBPS</b></font>"; ?>
</td>
</tr>
<tr>
<td width="25%">
<div align="right"><b><font color="#999999"><?php echo$GLOBALS['lang6'];?>:</font></b><font color="#999999"></font>
</div>
</td>
<td width="75%">
<?php echo "<font color=FFFFFF><b>$GLOBALS[currentlisteners]</b></font>"; ?>
</td>
</tr>
</table>
</body>
</html>
<?php } ?>
蚂蚁那就是我必须在日志中的错误
PHP Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/radionet/public_html/stats.php:17
Stack trace:
#0 /home/radionet/public_html/stats.php(17): SimpleXMLElement->__construct('<?xml version="...')
#1 {main}
thrown in /home/radionet/public_html/stats.php on line 17
线17将是
echo "<font color=66CCFF><b>$GLOBALS[lang9]<br>$GLOBALS[lang8]</b></font>"; exit; } else {
我问你一些建议来解决它,我已经尝试了一些遵循XML语法文件的指南,没有解决方案。
太感谢你了, 问候