Shoutbox

PHP: XML DOM script not returning values - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: PHP: XML DOM script not returning values (/showthread.php?tid=88725)

PHP: XML DOM script not returning values by ryxdp on 01-27-2009 at 03:48 AM

I've been writing a PHP script to parse and style the XML file generated by Status2FTP, which I've expanded upon from the original (top right, the DP is YASS though). But I've just tested it now, and it's not returning anything. It doesn't appear to be seeing the XML file properly. I have a feeling it's because I made a variable for the XML's location and used that for loading the DOMDocument, but I don't know why. The getlastupdate() function, when using the string instead of the variable, can find the file, but when I do the same for the XML loading, it still doesn't show anything.

Thanks :)


RE: PHP: XML DOM script not returning values by WDZ on 01-27-2009 at 04:18 AM

php code:
$rootarray = $objDOM->getElementsByTagName("Details");
foreach ($roottag1 as $rootval) {
It looks like you used $roottag1 where you meant $rootarray, or vice versa.

Also, your functions use variables that don't exist within the local scope. For example:
php code:
function getname() {
    echo "<span id=\"name\">$username</span>";
}
$username would be undefined there. See http://php.net/language.variables.scope.

Oh, and another bug:
php code:
if ($clean_strings = 1) {
You probably want to use the equality operator (==), not the assignment operator (=).
RE: PHP: XML DOM script not returning values by ryxdp on 01-27-2009 at 04:46 AM

Hmm, I may have uploaded an earlier version of the script, which would explain a lot of the errors in it.

MeEtc is currently helping me fix it, so I have to scrap the DOM method and use SimpleXML.