Hi Guys,
I Have this code to connect to the XML document on our FShost server, but it is not displaying each player, only one…if anyone could edit to suit, or explain to me why this is happening it would be great.
<?php
// XML Page
$feed_url = "http://64.22.78.67:98/xml";
# INITIATE CURL.
$curl = curl_init();
# CURL SETTINGS.
curl_setopt($curl, CURLOPT_URL,"$feed_url");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
# GRAB THE XML FILE.
$xmlX = curl_exec($curl);
curl_close($curl);
# SET UP XML OBJECT.
# Use either one of these, depending on revision of PHP.
# Comment-out the line you are not using.
//$xml = new SimpleXMLElement($xmlX);
$xml = simplexml_load_string($xmlX);
foreach($xml->Players as $item){
echo "
Name: {$item->Player->Name}<br />
Aircraft: {$item->Player->Aircraft}<br />
<br />
";
}
foreach($xml->FlightPlans as $item){
echo "
Name: {$item->FlightPlan->PlayerName}<br />
Plan: {$item->FlightPlan->Plan}<br />
<br />
";
}
?>
EDIT: here is the page
http://linkvirtual.getfreehosting.co.uk/fshost/aircraft.php
Cheers.