- simplexml_load_file: documentation ( source)
<?php //this reads 3hr PSI RSS feed from NEA
$Output_3hr = "";
$url_3hr = "http://www.haze.gov.sg/data/rss/nea_psi_3hr.xml";
$xml_3hr = simplexml_load_file($url_3hr);
for($i=0; $i<10; $i++){
$value_3hr = $xml_3hr->rss->channel->item[$i]->psi;
$Output_3hr .= "<p>$value_3hr</p>";
}
echo $Output_3hr;
?>