Tomatin 5 Day Weather Forecast
$context = stream_context_create(array('http' => array('header' => 'Accept: text/xml')));
$url = 'http://api.weatherunlocked.com/api/forecast/57.3074884,-3.9964916?app_id=86bb5ddd&app_key=ed095feb8bac6348f4785ca50b551fa5';
$xml = file_get_contents($url, false, $context);
$xml = simplexml_load_string($xml);
$weather = $xml->xpath("/Forecast/Days/Day"); ?>
$i = 0;
foreach ($weather as $tvalue2) {
if (++$i > 5) {
// stop after 5 loops
break;
}
$old_date2 = $tvalue2->date;
$date = str_replace('/', '-', $old_date2);
$new_long_date = date('l', strtotime($date));
$tic = round($tvalue2->Timeframes->Timeframe[3]->temp_c);
?>
echo $new_long_date; ?> |
|
c |
|
} ?>
Forecast by WeatherForecast.co.uk