简体   繁体   中英

error with XML syntax - Uncaught exception 'Exception'

i need to some helps to understand and possibly to solve problem with a php file, this file is part of old whmsonic template that isn't available more to download, i have a fresh installation but there's not solution even with it.

This is the file

 <?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'); $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 { $shoutcast_xml = new SimpleXMLElement($d); $bitrate = utf8_decode($shoutcast_xml->BITRATE); $streamstatus = utf8_decode($shoutcast_xml->STREAMSTATUS); $currentlisteners = utf8_decode($shoutcast_xml->CURRENTLISTENERS); $servertitle = utf8_decode($shoutcast_xml->SERVERTITLE); $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 } ?> 

ant it is the error that i have in the log

 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 

line 17 would be

       echo "<font color=66CCFF><b>$GLOBALS[lang9]<br>$GLOBALS[lang8]</b></font>"; exit; } else {

i ask you some suggestions to solve it, i have tried something alredy following guides for XML syntax files, without solution.

Thank you so much, Regards

You forgot the quotes in the vars $GLOBALS[]

Try this:

echo "<font color=66CCFF><b>$GLOBALS['lang9']<br>$GLOBALS['lang8']</b></font>"; exit; } else {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM