public function doUpdate() {
[COLOR="#B22222"]$loop = 5;[/COLOR]
// download google weather XML into local file for caching
[COLOR="#B22222"]while($loop--)
{[/COLOR]
$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.de/ig/api?weather=$city&oe=UTF8&hl=DE"));
curl_setopt($curl, CURLOPT_FILE, $file);
curl_exec($curl);
curl_close($curl);
fclose($file);
}
[COLOR="#B22222"] if(filesize("cache/weather.xml") > 1000)
break;
sleep(5);
}[/COLOR]
}
public function doUpdate() {
[COLOR=#B22222] $loop = 5;[/COLOR]
// download google weather XML into local file for caching
[COLOR=#B22222] while($loop--)
{[/COLOR]
$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.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);
[COLOR=#000000] // [/COLOR][COLOR=#d3d3d3]curl_close($curl);[/COLOR][COLOR=#000000] // Entfernen ![/COLOR][COLOR=#d3d3d3][/COLOR]
fclose($file);
}
[COLOR=#FF0000] curl_close($curl);[/COLOR]
[COLOR=#B22222] if(filesize("cache/weather.xml") > 1000)
break;
sleep(5);
}[/COLOR]
}
public function doUpdate() {
// download google weather XML into local file for caching
......
$file = fopen("cache/weather.tmp", "w");
......
fclose($file);
}
if(filesize("cache/weather.tmp") > 1000) {
copy ("cache/weather.tmp", "cache/weather.xml");
}
}