- file_get_contents: documentation ( source)
- json_decode: documentation ( source)
<?php
$json_string = file_get_contents("http://api.wunderground.com/api/a4ae759739c92427/forecast/q/UK/Newcastle.json");
$parsed_json = json_decode($json_string);
for($i = 0; $i <= 1; $i++) {
$day = $parsed_json->{'forecast'}->{'txt_forecast'}->{'forecastday'}->{i};
return $day->{'title'} . "<br>" . $day->{'fcttext_metric'} . "<br><br>";
}