Aravinthan
New Member
- Messages
- 68
- Reaction score
- 0
- Points
- 0
Hi, I have a code that parses this xml file:
http://www.elorating.com/ranking-services/ratingquery?name=_ŴӨŴ_&mode=SP&laddertype=51&game=3
Code:
And the code that shows the data:
But as you can see The name and abbrev tag as special characters,
and when it outputs it doesnt show it the same way:
http://www.warriorsofwar.co.nr
How can I change the script to output the same results, or at least Warriors of War normally and WoW normally?
I am sure its stuff like:
Something like that, but I aint sure...
Thanks for your help.
http://www.elorating.com/ranking-services/ratingquery?name=_ŴӨŴ_&mode=SP&laddertype=51&game=3
Code:
Code:
<?php
$xml_name_key = "*RATINGS*CLANRATING*NAME";
$xml_abbrev_key = "*RATINGS*CLANRATING*ABBREV";
$xml_rank_key = "*RATINGS*CLANRATING*RANK";
$xml_rate_key = "*RATINGS*CLANRATING*RATE";
$xml_active_key = "*RATINGS*CLANRATING*ACTIVE";
$story_array = array();
$counter = 0;
class xml_story{
var $name, $abbrev, $rank, $rate, $ractive;
}
function startTag($parser, $data){
global $current_tag;
$current_tag .= "*$data";
}
function endTag($parser, $data){
global $current_tag;
$tag_key = strrpos($current_tag, '*');
$current_tag = substr($current_tag, 0, $tag_key);
}
function contents($parser, $data){
global $current_tag, $xml_name_key, $xml_abbrev_key, $xml_rank_key, $xml_rate_key, $xml_active_key, $counter, $story_array;
switch($current_tag){
case $xml_name_key:
$story_array[$counter] = new xml_story();
$story_array[$counter]->name = $data;
break;
case $xml_abbrev_key:
$story_array[$counter]->abbrev = $data;
break;
case $xml_rank_key:
$story_array[$counter]->rank = $data;
break;
case $xml_rate_key:
$story_array[$counter]->rate = $data;
break;
case $xml_active_key:
$story_array[$counter]->active = $data;
$counter++;
break;
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
$fp = fopen("[URL]http://www.elorating.com/ranking-services/ratingquery?name=_%C5%B4%D3%A8%C5%B4_&mode=SP&laddertype=51&game=3[/URL]", "r") or die("Could not open file");
$data = fread($fp, 4096) or die("Could not read file");
if(!xml_parse($xml_parser, $data))
{
die("Error on line " . xml_get_error_code($xml_parser));
}
xml_parser_free($xml_parser);
?>
Code:
<table>
<?php
for($x=0;$x<count($story_array);$x++){
echo "<tr><td>Name: </td>" ;
echo "<td>" . $story_array[$x]->name . "</td></tr>";
echo "<tr><td>Abbrev: </td>" ;
echo "<td>" . $story_array[$x]->abbrev . "</td></tr>";
echo "<tr><td>Rank: </td>" ;
echo "<td>" . $story_array[$x]->rank . "</td></tr>";
echo "<tr><td>Rate: </td>" ;
echo "<td>" . round($story_array[$x]->rate, 4) . "</td></tr>";
}
?>
</table>
and when it outputs it doesnt show it the same way:
http://www.warriorsofwar.co.nr
How can I change the script to output the same results, or at least Warriors of War normally and WoW normally?
I am sure its stuff like:
Code:
If name=ŴầРthen W
Thanks for your help.