public function doUpdate() {
$loop = 5;
// download google weather XML into local file for caching
while($loop--)
{
$city = urlencode( $this->config['city'] );
$curl = curl_init();
$file = fopen("cache/weather.xml", "w");
if ($file)
{
curl_setopt($curl, CURLOPT_URL, utf8_encode("http://www.google.com/ig/api?weather=$city&oe=UTF8&hl=DE"));
curl_setopt($curl, CURLOPT_FILE, $file);
curl_setopt($curl, CURLOPT_USERAGENT, utf8_encode("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"));
curl_exec($curl);
fclose($file);
}
curl_close($curl);
if(filesize("cache/weather.xml") > 1000)
break;
sleep(5);
}
}
public function doUpdate() {
// download google weather XML into local file for caching
$city = urlencode( $this->config['city'] );
$curl = curl_init();
$file = fopen("cache/weather.tmp", "w");
if ($file)
{
curl_setopt($curl, CURLOPT_URL, utf8_encode("http://www.google.de/ig/api?weather=$city&oe=UTF8"));
curl_setopt($curl, CURLOPT_FILE, $file);
curl_exec($curl);
curl_close($curl);
fclose($file);
}
if(filesize("cache/weather.tmp") > 1000) {
copy ("cache/weather.tmp", "cache/weather.xml");
}
public function doUpdate() {
$loop = 5;
// download google weather XML into local file for caching
while($loop--)
{
$city = urlencode( $this->config['city'] );
$curl = curl_init();
$file = fopen("cache/weathertmp.xml", "w");
if ($file)
{
curl_setopt($curl, CURLOPT_URL, utf8_encode("http://www.google.de/ig/api?weather=$city&oe=UTF8&hl=DE"));
curl_setopt($curl, CURLOPT_FILE, $file);
curl_setopt($curl, CURLOPT_USERAGENT, utf8_encode("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"));
curl_exec($curl);
// curl_close($curl); // Entfernen !
fclose($file);
}
curl_close($curl);
if(filesize("cache/weathertmp.xml") > 1000)
copy ("cache/weathertmp.xml", "cache/weather.xml");
break;
sleep(5);
}
}
if ($updateData || !file_exists($filename))
$this->doUpdate();
$diff_seconds_weather = (time() - filectime($filename));
if (!file_exists($filename) || ($diff_seconds_weather > ($this->config['update_weather']*60))){
$this->doUpdate();
}
update_weather = 30
if(filesize("cache/weathertmp.xml") > 1000)
copy ("cache/weathertmp.xml", "cache/weather.xml");
break;
if(filesize("cache/weathertmp.xml") > 1000)
[COLOR="#FF0000"] {[/COLOR]
copy ("cache/weathertmp.xml", "cache/weather.xml");
break;
[COLOR="#FF0000"] }[/COLOR]
XML-Verarbeitungsfehler: Syntax-Fehler
Adresse: http://www.google.com/ig/api?weather=frankfurt
Zeile Nr. 1, Spalte 1:Unsupported API
^
... Dein Wunsch ist mir Befehl.... Die müsste allerdings noch jemand parsen, dazu fehlt mir der Background