Ok,
I'm hoping there are some clever sods in here that can help me with a php script I have for converting an xml feed into HTML.
I grabbed it from a website I use which displayed the member list and modified it to show more details from another feed. I now have it displaying the fields I want but I need to break the display up and I'm assuming it's because it's using the single parameter still
This is the display http://www.simpilots.co.uk/testfeed.php
Basically the feed is showing a username, followed by an aircraft name, 2 departure and arrival airport and income earned. Then need to seperate after that and put a $ sign in for the income.
Can someone help please?
I'm hoping there are some clever sods in here that can help me with a php script I have for converting an xml feed into HTML.
I grabbed it from a website I use which displayed the member list and modified it to show more details from another feed. I now have it displaying the fields I want but I need to break the display up and I'm assuming it's because it's using the single parameter still
Code:
<?php
$mblist = '';
$flag = false;
function openElement($parser, $element, $attributes) {
global $flag;
if ($element == 'pilot') $flag = true;
if ($element == 'aircraft') $flag = true;
if ($element == 'from') $flag = true;
if ($element == 'to') $flag = true;
if ($element == 'income') $flag = true;
}
function closeElement($parser, $element) {
global $flag;
$flag = false;
}
function characterData($parser, $data) {
global $flag,$mblist;
if ($flag) $mblist[] = $data;
}
// Create an XML parser
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($parser, "openElement", "closeElement");
xml_set_character_data_handler($parser, "characterData");
// Open the XML file for reading, change path for your Data
$document = file_get_contents("http://atilla.hinttech.nl:8080/fseconomy/xml?id=5186&key=IYASV3D7&query=groupLog&from=5&amount=10","r")
or die("Error reading XML data.");
xml_parse($parser, $document);
xml_parser_free($parser);
echo '<table border=1>';
echo '<tr><td><b>User Name</b></td></tr>';
foreach ($mblist as $value) {
echo '<tr><td>';
echo $value;
echo '</td></tr>';
}
echo '</table>';
?>
This is the display http://www.simpilots.co.uk/testfeed.php
Basically the feed is showing a username, followed by an aircraft name, 2 departure and arrival airport and income earned. Then need to seperate after that and put a $ sign in for the income.
Can someone help please?