Hallo,
ich habe ein Problem mit meinem Wettermodul:
Hier ersteinmal die Dateien:
XML-Datei (Google Weather API):
HTML-Code:
<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<forecast_information>
<city data="Hollenstedt, Lower Saxony"/>
<postal_code data="Hollenstedt"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2010-10-22"/>
<current_date_time data="2010-10-22 07:50:00 +0000"/>
<unit_system data="SI"/>
</forecast_information>
<current_conditions>
<condition data="Leichter Regen"/>
<temp_f data="46"/>
<temp_c data="8"/>
<humidity data="Feuchtigkeit: 100 %"/>
<icon data="/ig/images/weather/mist.gif"/>
<wind_condition data="Wind: W mit 24 km/h"/>
</current_conditions>
<forecast_conditions>
<day_of_week data="Fr."/>
<low data="4"/>
<high data="11"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Vereinzelt Regen"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Sa."/>
<low data="5"/>
<high data="10"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Vereinzelt Regen"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="So."/>
<low data="2"/>
<high data="10"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Vereinzelt Regen"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="Mo."/>
<low data="0"/>
<high data="11"/>
<icon data="/ig/images/weather/sunny.gif"/>
<condition data="Klar"/>
</forecast_conditions>
</weather>
</xml_api_reply>
die PHP-Datei mit der ich im Moment die XML Datei auslese und auf http://benedikt-woll.de in einer der gelben Boxen ausgebe.
PHP-Code:
<link rel="stylesheet" href="http://www.benedikt-woll.de/modules/mod_wetter/details.css" type="text/css" /><?php
defined
('_JEXEC') or die('Restricted access');
function 
w_data(&$el$att='data') {
    foreach (
$el->attributes() as $a => $b) {
        if (
$a == $att) return $b;
    }
    return 
null;
}
$content file_get_contents("http://www.google.com/ig/api?weather=Hollenstedt&hl=de");
$wxml simplexml_load_string(utf8_encode($content));
$info $wxml->xpath('/xml_api_reply/weather/forecast_information');
$conditions $wxml->xpath('/xml_api_reply/weather/current_conditions');
$wetter $wxml->xpath('/xml_api_reply/weather/current_conditions/icon');
?><?php echo "Das Wetter in Hollenstedt um:";  $timestamp time();  $uhrzeit date("H:i",$timestamp);  echo $uhrzeit," Uhr";?><br /><br />
    Wetterlage: <?php echo w_data ($conditions [0]->condition);?><br/>
    <div id="icon"><?php include 'icon.php';//Einbindung der Icons von Google Weather API//?></div><br />
    Temperatur: <?php echo w_data($conditions[0]->temp_c); ?>°C<br /><br />
                <?php $text w_data  ($conditions[0]->humidity);$text str_replace("Feuchtigkeit","Luftfeuchtigkeit"$text);echo ($text);?> <br /><br />
    Windrichtung: <?php $string w_data ($conditions[0]->wind_condition);$token strtok($string" ");$token strtok" ");echo $token?> <br /><br />
    Windstärke: <?php $string w_data ($conditions[0]->wind_condition);$token strtok($string" ");$token strtok" ");$token2 strtok" ");$token3 strtok" ");echo $token3;$token4 strtok" ");?> km/h<br /><br />
    Noch mehr Wetterdaten gibt es <a href="http://benedikt-woll.de/wetter">hier.</a>
<?php
$zeit 
= ($uhrzeit);

$string2 w_data ($conditions[0]->temp_c);
$temperatur = ($string2);

$text1 w_data ($conditions[0]->humidity);
$text1 str_replace("Feuchtigkeit:",""$text1);
$feuchte = ($text1); 

$string w_data ($conditions[0]->wind_condition);$token strtok($string" ");$token strtok" ");
$richtung = ($token);

$string w_data ($conditions[0]->wind_condition);$token strtok($string" ");$token strtok" ");$token2 strtok" ");$token3 strtok" ");
$stärke = ($token3);

$string6 w_data ($conditions[0]->condition);
$lage = ($string6);
  
$eintragen mysql_query("INSERT INTO wetter 
  (Zeit, Lage, Temperatur,  Feuchtigkeit, Windrichtung, Windstärke) VALUES
  ('$zeit', '$lage', '$temperatur', '$feuchte', '$richtung','$stärke')"
);
?>
Immer wenn Google die Wetterdaten in der XML Datei aktualisiert, sollen die Daten der XML Datei (nur die "Current_Conditions") in die Datenbank erstmals geschrieben werden und dann nach dem ersten Eintrag sollen die datensätze der mySQL Datebank dann nur noch geändert werden, also das immer nur eine Zeile der Tabelle belegt ist.
Und es soll auch so sein dass ich die Daten nicht direkt aus der XML-Datei auslese sondern dass ich eine Datenbankabfrage und Ausgabe mache.

Ich hoffe ihr könnt mir helfen

Danke

KaSsi