Cory94bailly Posted April 15, 2009 Share Posted April 15, 2009 <html> <head> <title> TEST12345 </title> </head> <body> <dl> <?php $insideitem = false; $tag = ""; $place = ""; $previousplace = ""; $matchesplayed = ""; $wins = ""; $losses = ""; $winpercentage = ""; $gamesfor = ""; $gamesagainst = ""; $shutouts = ""; $streak = ""; $xp = ""; $level = ""; $levelup = ""; function startElement($parser, $name, $attrs) { global $insideitem, $tag, $place, $previousplace, $matchesplayed, $wins, $losses, $winpercentage, $gamesfor, $gamesagainst, $shutouts, $streak, $xp, $level, $levelup; if ($insideitem) { $tag = $name; } elseif ($name == "CURRENTSTATS") { $insideitem = true; } } function endElement($parser, $name) { global $insideitem, $tag, $place, $previousplace, $matchesplayed, $wins, $losses, $winpercentage, $gamesfor, $gamesagainst, $shutouts, $streak, $xp, $level, $levelup; if ($name == "CURRENTSTATS") { echo $place; echo $previousplace; echo $matchesplayed; echo $wins; echo $losses; echo $winpercentage; echo $gamesfor; echo $gamesagainst; echo $shutouts; echo $streak; echo $xp; echo $level; echo $levelup; $place = ""; $previousplace = ""; $matchesplayed = ""; $wins = ""; $losses = ""; $winpercentage = ""; $gamesfor = ""; $gamesagainst = ""; $shutouts = ""; $streak = ""; $xp = ""; $level = ""; $levelup = ""; $insideitem = false; } } function characterData($parser, $data) { global $insideitem, $tag, $place, $previousplace, $matchesplayed, $wins, $losses, $winpercentage, $gamesfor, $gamesagainst, $shutouts, $streak, $xp, $level, $levelup; if ($insideitem) { switch ($tag) { case "PLACE": $place .= $data; break; case "PREVIOUSPLACE": $previousplace .= $data; break; case "MATCHESPLAYED": $matchesplayed .= $data; break; case "WINS": $wins .= $data; break; case "LOSSES": $losses .= $data; break; case "WINPERCENTAGE": $winpercentage .= $data; break; case "GAMESFOR": $gamesfor .= $data; break; case "GAMESAGAINST": $gamesagainst .= $data; break; case "SHUTOUTS": $shutouts .= $data; break; case "STREAK": $streak .= $data; break; case "XP": $xp .= $data; break; case "LEVEL": $level .= $data; break; case "LEVELUP": $levelup .= $data; break; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("http://gamebattles.com/xbox360/call-of-duty-world-at-war/team/we-punched-ur-babies/stats.xml","r") or die("Error reading XML data."); while ($data = fread($fp, 4096)) xml_parse($xml_parser, $data, feof($fp)) or die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); fclose($fp); xml_parser_free($xml_parser); ?> </dl> </body> </html> There's my code but I am getting this: http://etsoldiers.com/stats.php Anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/154145-rss-reading-problem/ Share on other sites More sharing options...
The Little Guy Posted April 15, 2009 Share Posted April 15, 2009 The XML file is invalid. There cannot be any < or > in the file, they must be converted to < or $gt; unless it is an XML tag, but if it is display data, for example, it must be converted. Link to comment https://forums.phpfreaks.com/topic/154145-rss-reading-problem/#findComment-810344 Share on other sites More sharing options...
Cory94bailly Posted April 15, 2009 Author Share Posted April 15, 2009 The XML file is invalid. There cannot be any < or > in the file, they must be converted to < or $gt; unless it is an XML tag, but if it is display data, for example, it must be converted. Oh, sorry for the 'noob-ness' but I don't ever use rss or xml or that stuff.. (By the way, I found this exact script [nothing changed] on this site and the guy said it worked for gamebattles..) How could I fix it/make it work? Link to comment https://forums.phpfreaks.com/topic/154145-rss-reading-problem/#findComment-810907 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.