Rosco-SS
08-18-2004, 05:52 PM
Ok so,
I downloaded the xml-output file from TribalWar by Heat, to show XML information on my teams webpage. I think I entered the fields correctly, and If I didn't I tried as many things to at least show something but still nothing. All it says is "an error occurred while processing this directive"
The include tag is: <!--#include virtual="/output.php" --> Thats straight from the readme.
This is the output.php
<?php
/* output.php team xml data parser by Heat/Stuntz
* (modified news parser script)
* This php script makes use of the xml data
* provided by teamwarfare.com
* It will display your team's upcoming match info and
* current ranking on your webpage.
* email: stuntz@tribalvengeance.ne t
*/
/*Which Team(s) info do you want to display?
* (if team name has multiple words, use + between words)
* EXAMPLE(two teams): $Symbols = array('Team+Zoo', 'Aurora');
* EXAMPLE(one team): $Symbols = array('Aurora');
*/
$Symbols = array('Ill+Jihad');
$URI = 'http://www.teamwarfare.com/xml/viewteam_v2.asp?team=Ill+ Jihad';
$ParserProbs = array();
$DataProbs = array();
$XmlEntities = array(
'&' => '&',
'<' => '<',
'>' => '>',
''' => '\'',
'"' => '"',
);
function StartHandler(&$Parser, &$Elem, &$Attr) {
global $Data, $CData, $XmlEntities;
$CData = array();
while ( list($Key, $Val) = each($Attr) ) {
$Data["$Elem:$Key"] = strtr(trim($Val), $XmlEntities);
}
}
function CharacterHandler(&$Parser, &$Line) {
global $CData;
$CData[] = $Line;
}
function EndHandler(&$Parser, &$Elem) {
global $Data, $CData, $DataProbs, $Sym, $XmlEntities;
$Data[$Elem] = strtr( trim( implode('', $CData) ), $XmlEntities);
switch ($Elem) {
case 'NAME':
break;
case 'OPPONENTNAME':
break;
case 'HTMLLINK':
break;
case 'RANK':
break;
case 'WINS':
break;
case 'LOSSES':
break;
case 'FORFEITS':
break;
case 'MATCHDATE':
if ( count($DataProbs) ) {
echo "\nData for $Sym had problems:\n";
echo implode("\n", $DataProbs) . "\n\n";
$DataProbs = array();
}
else {
echo '<div align="center"><font size="1" face="Verdana"><strong>'
. "{$Data['NAME']} V. "
. '<a href="'
. "{$Data['HTMLLINK']}"
. '"'
. ' target=blank>'
. "{$Data['OPPONENTNAME']}"
. "</a></strong><br>When:<strong> {$Data['MATCHDATE']}</strong><br>"
. "Our Current Rank:<strong>{$Data['RANK']} </strong><br> "
. "Wins/Losses/Forfeits<strong> {$Data['WINS']}/"
. "{$Data['LOSSES']}/"
. "{$Data['FORFEITS']}</strong><br><br>";
}
}
}
// Loop through for multiple teams and matches.
foreach ($Symbols as $Sym) {
$Data = @file("$URI$Sym");
if ( empty($Data) ) {
$ParserProbs[] = "$URI$Sym\n Had problem opening file.";
continue;
}
$Contents = implode('', $Data);
$Contents = preg_replace('/&(?!\w{2,6};)/', '&', $Contents);
$Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
$Data = array();
$Parser = xml_parser_create('ISO-8859-1');
xml_set_element_handler($ Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_ha ndler($Parser, 'CharacterHandler');
if ( !xml_parse($Parser, $Contents, TRUE) ) {
$ParserProbs[] = "Had problem parsing data for $Sym:\n "
. xml_error_string(xml_get_ error_code($Parser));
}
}
if ( count($ParserProbs) ) {
echo "\n" . implode("\n", $ParserProbs);
}
?>
Anyone help me? I made sure the webpage has SSI's enabled, and it does have access to it but its just not displaying. Here's a link (http://freetreeporn.com/ij/record.htm) for the webpage.
I downloaded the xml-output file from TribalWar by Heat, to show XML information on my teams webpage. I think I entered the fields correctly, and If I didn't I tried as many things to at least show something but still nothing. All it says is "an error occurred while processing this directive"
The include tag is: <!--#include virtual="/output.php" --> Thats straight from the readme.
This is the output.php
<?php
/* output.php team xml data parser by Heat/Stuntz
* (modified news parser script)
* This php script makes use of the xml data
* provided by teamwarfare.com
* It will display your team's upcoming match info and
* current ranking on your webpage.
* email: stuntz@tribalvengeance.ne t
*/
/*Which Team(s) info do you want to display?
* (if team name has multiple words, use + between words)
* EXAMPLE(two teams): $Symbols = array('Team+Zoo', 'Aurora');
* EXAMPLE(one team): $Symbols = array('Aurora');
*/
$Symbols = array('Ill+Jihad');
$URI = 'http://www.teamwarfare.com/xml/viewteam_v2.asp?team=Ill+ Jihad';
$ParserProbs = array();
$DataProbs = array();
$XmlEntities = array(
'&' => '&',
'<' => '<',
'>' => '>',
''' => '\'',
'"' => '"',
);
function StartHandler(&$Parser, &$Elem, &$Attr) {
global $Data, $CData, $XmlEntities;
$CData = array();
while ( list($Key, $Val) = each($Attr) ) {
$Data["$Elem:$Key"] = strtr(trim($Val), $XmlEntities);
}
}
function CharacterHandler(&$Parser, &$Line) {
global $CData;
$CData[] = $Line;
}
function EndHandler(&$Parser, &$Elem) {
global $Data, $CData, $DataProbs, $Sym, $XmlEntities;
$Data[$Elem] = strtr( trim( implode('', $CData) ), $XmlEntities);
switch ($Elem) {
case 'NAME':
break;
case 'OPPONENTNAME':
break;
case 'HTMLLINK':
break;
case 'RANK':
break;
case 'WINS':
break;
case 'LOSSES':
break;
case 'FORFEITS':
break;
case 'MATCHDATE':
if ( count($DataProbs) ) {
echo "\nData for $Sym had problems:\n";
echo implode("\n", $DataProbs) . "\n\n";
$DataProbs = array();
}
else {
echo '<div align="center"><font size="1" face="Verdana"><strong>'
. "{$Data['NAME']} V. "
. '<a href="'
. "{$Data['HTMLLINK']}"
. '"'
. ' target=blank>'
. "{$Data['OPPONENTNAME']}"
. "</a></strong><br>When:<strong> {$Data['MATCHDATE']}</strong><br>"
. "Our Current Rank:<strong>{$Data['RANK']} </strong><br> "
. "Wins/Losses/Forfeits<strong> {$Data['WINS']}/"
. "{$Data['LOSSES']}/"
. "{$Data['FORFEITS']}</strong><br><br>";
}
}
}
// Loop through for multiple teams and matches.
foreach ($Symbols as $Sym) {
$Data = @file("$URI$Sym");
if ( empty($Data) ) {
$ParserProbs[] = "$URI$Sym\n Had problem opening file.";
continue;
}
$Contents = implode('', $Data);
$Contents = preg_replace('/&(?!\w{2,6};)/', '&', $Contents);
$Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
$Data = array();
$Parser = xml_parser_create('ISO-8859-1');
xml_set_element_handler($ Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_ha ndler($Parser, 'CharacterHandler');
if ( !xml_parse($Parser, $Contents, TRUE) ) {
$ParserProbs[] = "Had problem parsing data for $Sym:\n "
. xml_error_string(xml_get_ error_code($Parser));
}
}
if ( count($ParserProbs) ) {
echo "\n" . implode("\n", $ParserProbs);
}
?>
Anyone help me? I made sure the webpage has SSI's enabled, and it does have access to it but its just not displaying. Here's a link (http://freetreeporn.com/ij/record.htm) for the webpage.