ah don't worry guys, I figured it out, a few hours later the past week xD
in a small brief, this is what I did.
1) lots of JSON parsing and data extraction
Then I downloaded the zip file to my server like:
set_time_limit(0);
copy($url, 'file.zip');
after that, unziped the file
$zip = new ZipArchive;
if ($zip->open('game.zip') === TRUE) {
$zip->extractTo('./');
$zip->close();
echo 'unzip ok <br/>';
} else {
echo 'unzip failed';
}
//here more JSON parsing, and fun stuff
and finally copied the original to a new directory, and deleted the one in my "chron_job_folder", using the 2 following methods:
//copy the directory recursively
function full_copy($source, $target) {
if (is_dir($source)) {
@mkdir($target);
$d = dir($source);
while (FALSE !== ( $entry = $d->read() )) {
if ($entry == '.' || $entry == '..') {
continue;
}
$Entry = $source . '/' . $entry;
if (is_dir($Entry)) {
full_copy($Entry, $target . '/' . $entry);
continue;
}
copy($Entry, $target . '/' . $entry);
}
$d->close();
} else {
copy($source, $target);
}
}
//reomove the directory recursively
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
and, the responses to my post from ppl trying to help = 0 (again)
I guess this days, everybody is so busy. but I leave the complete solution to 3 common troubles here :) because I like to share knowledge, As my university slogan said: "Go and teach everybody".
I hope someone finds this post usefull :)