Subversion Repositories Transart

Compare Revisions

Ignore whitespace Rev 7 → Rev 8

/index.php
126,69 → 126,6
</table>
</form> </td>
</tr>
<tr>
<td>
<?php
$apiKey = "0ad385eea94cf2a775c48da2dfc726e9";
$cityId = "2761369";
$googleApiUrl = "http://api.openweathermap.org/data/2.5/weather?id=" . $cityId . "&lang=de&units=metric&APPID=" . $apiKey;
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $googleApiUrl);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
 
curl_close($ch);
$data = json_decode($response);
$currentTime = time();
?>
<div class="report-container">
<h2><?php echo $data->name; ?> Wetter</h2>
<div class="time">
<div><?php echo date("l g:i a", $currentTime); ?></div>
<div><?php echo date("jS F, Y",$currentTime); ?></div>
<div><?php echo ucwords($data->weather[0]->description); ?></div>
</div>
<div class="weather-forecast">
<img
src="http://openweathermap.org/img/w/<?php echo $data->weather[0]->icon; ?>.png"
class="weather-icon" /> <?php echo $data->main->temp_max; ?>°C<span
class="min-temperature"><?php echo $data->main->temp_min; ?>°C</span>
</div>
<div class="time">
<div>Humidity: <?php echo $data->main->humidity; ?> %</div>
<div>Wind: <?php echo $data->wind->speed; ?> km/h</div>
</div>
</div>
 
</td>
</tr>
<tr>
<td class="stil3">
<table class="ui celled green striped table">
<?php
// Die Datei test.xml enthält ein XML-Dokument mit einem Wurzel-Element
// und mindestens einem Element /[root]/title.
 
if ($xml = simplexml_load_file('http://rss.orf.at/news.xml')) {
 
//print_r($xml);
foreach ($xml->item as $item) {
echo "<tr>";
echo "<td>".$item->title."</td>"; echo "<td><a href='".$item->link."' target='_blank'>LINK</a></td>"; echo '</tr>';
}
}
?>
</table>
</td>
 
</tr>
</table> </td>
</tr>
</table>