Hallo,
Habe mir nun ein kleines Script zusammengekratzt, welches die Wetterdaten ausgeben soll aber es funktioniert nicht so wie ich will.
Ich bekomm immer nur das Html Gerüst ohne werte
hier mal der code
Habe mir nun ein kleines Script zusammengekratzt, welches die Wetterdaten ausgeben soll aber es funktioniert nicht so wie ich will.
Ich bekomm immer nur das Html Gerüst ohne werte
hier mal der code
PHP:
<?php
$city = "New+York";
$url2="http://www.google.com/ig/api?oe=utf-8&hl=de&weather=".$city;
echo $url2;
//Seichern der XML-Daten
$site2 = file_get_contents($url2);
//Erstellung array aus XML-Daten
$xml3 = new SimpleXMLElement($site2);
//Auslesen der einzelnen XML-Felder
$stadt_1 = $xml3->weather->forecast_information->city[data];
$himmel_1 = $xml3->weather->current_conditions->condition[data];
$temperatur_1 = $xml3->weather->current_conditions->temp_c[data];
$icon_1 = $xml3->weather->current_conditions->icon[data];
$wind_1 = $xml3->weather->current_conditions->wind_condition[data];
$feucht_1 = $xml3->weather->current_conditions->humidity[data];
$icon_12 = $xml3->weather->forecast_conditions[1]->icon[data];
$day_12 = $xml3->weather->forecast_conditions[1]->day_of_week[data];
$l_12 = $xml3->weather->forecast_conditions[1]->low[data];
$h_12 = $xml3->weather->forecast_conditions[1]->high[data];
$icon_13 = $xml3->weather->forecast_conditions[2]->icon[data];
$day_13 = $xml3->weather->forecast_conditions[2]->day_of_week[data];
$l_13 = $xml3->weather->forecast_conditions[2]->low[data];
$h_13 = $xml3->weather->forecast_conditions[2]->high[data];
$icon_14 = $xml3->weather->forecast_conditions[3]->icon[data];
$day_14 = $xml3->weather->forecast_conditions[3]->day_of_week[data];
$l_14 = $xml3->weather->forecast_conditions[3]->low[data];
$h_14 = $xml3->weather->forecast_conditions[3]->high[data];
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<head>
<style type="text/css" media="all">
#weather{width:600px; height:200px;background-color:#03C;}.weather_head{font-size:24px;}
</style>
</head>
<body>
<div id="weather">
<div style="width:100%; height:25px; float:left;">
<center><span class="weather_head"><? print $stadt_1; ?></span></center>
</div>
<div style="width:200px;; height:175px; float:left;">
<div style="width:100%; height:24px;">
<center><span style="font-size:23px;">Aktuell</span></center>
</div>
<center><div style="width:200px; height:25px;"><? print $feucht_1; ?></div></center>
<center><div style="width:200px; height:25px;"><? print $temp; ?></div></center>
<div style="width:200px; height:50px;">
<center><img src="<?= 'http://www.google.com' . $icon?>"/></center>
</div>
<center>
<div style="width:200px; height:25px;"><? print $lage; ?></div>
</center>
</div>
<div style="width:200px; height:175px; float:left;">
<div style="width:100%; height:24px;">
<center>
<span style="font-size:23px;">Morgen</span>
</center>
</div>
<center><div style="width:200px; height:25px;"><? echo('hallo'); ?></div></center>
<center><div style="width:200px; height:25px;"><? print $temp1; ?></div></center>
<div style="width:200px; height:50px;">
<center><img src="<?= 'http://www.google.com' . $icon1?>"/></center>
</div>
<center>
<div style="width:200px; height:25px;"><? print $lage1; ?></div>
</center>
</div>
<div style="width:200px; height:175px; float:left;">
<div style="width:100%; height:24px;">
<center>
<span style="font-size:23px;">Übermorgen</span>
</center>
</div>
<? print $pfad;?>
</div>
</div>
</body>
</html>