Page 1 of 1

XML Help

Posted: Sun Feb 20, 2011 10:10 am
by VarwigDude
Hello Everyone,

I am trying to Use SimpleXML to Work, a Very simple Echo of a Root. I cannot for the life of me figure this out. Any Help would be appreciated. Nothing will print.

Code: Select all

<?php
    $file = "http://weather.aero/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&stationString=KDEN&hoursBeforeNow=1"; 

	// load file 
	$xml = simplexml_load_file($file) or die ("Unable to load XML file!"); 
	
	// access XML data 
    echo 'Metar: '.$xml->metar->raw_text.'<br />';
?>

Re: XML Help

Posted: Sun Feb 20, 2011 4:18 pm
by Peec
should be:
$xml->data[0]->METAR->temp_c


do print_r($xml);