hm, dann so vllt (php5)
PHP-Code:
//unzip with PHP 5.2.0 or later (zlib)
function unzip($file)
{
$zip = new ZipArchive();
if ($zip->open($file) === TRUE) {
$zip->extractTo('./');
$zip->close();
echo 'Erfolgreich entzippt';
} else {
echo 'Konnte Zip nicht öffnen';
}
}
function getRawHttpHeader($host,$doc)
{
$httpheader = "";
$fp = fsockopen ($host, 80, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno) \n";
}
else
{
fputs ($fp, "GET $doc HTTP/1.0\r\nHost: " . $host. "\r\n\r\n");
while (!feof($fp))
{
$httpresult = fgets ($fp,1024);
$httpheader = $httpheader.$httpresult;
if (ereg("^\r\n",$httpresult))
break;
}
fclose ($fp);
}
return $httpheader;
}
function getArrayHttpHeader($url)
{
$url = ereg_replace("http://","",$url);
$endHostPos = strpos($url,"/");
if (!$endHostPos)
$endHostPos = strlen($url);
$host = substr($url,0,$endHostPos);
$doc = substr($url,$endHostPos,strlen($url)-$endHostPos);
if ($doc=="")
$doc = "/";
$raw = getRawHttpHeader($host,$doc);
$tmpArray = explode("\n",$raw);
for ($i=0;$i<sizeof($tmpArray); $i++)
{
@list($name, $value) = explode(':', $tmpArray[$i], 2);
$array[trim($name)]=trim($value);
}
return $array;
}
$array = (getArrayHttpHeader("http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip"));
if (strtotime($array['Last-Modified'])> LASTUPDATE)
{
//Kopiere und entpacke neues update
if (copy("http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip","ip-to-country.csv.zip"))
{
unzip("ip-to-country.csv.zip");
}
require(laenderupdate.int.php); // Cron ausführen
}
LASTUPDATE = timestamp der letzten aktualisierung
vllt kennt ja jmd von euch ne unzip-funktion die auch mit php4 funktioniert. war jetzt zu faul zu googlen