OK, FIRST, you need to download the first file:
$filepointer = fopen ("http://www.domainname.com/filetoopen.zip", "r");
$contents = fread ($open, 999999999);
fclose ($filepointer);
Now that has opened the remote file in READ-ONLY mode, and then has taken all the contents of the file and put it into the variable '$contents'. Now you have to write that file to the appropriate directory. So first you have to open a new filepointer and create the new file:
$filepointer = fopen ("/localplace/to/put/file.zip", "w+");
fwrite ($filepointer, $contents);
fclose ($filepointer);
That opens the local file, writes the $contents to the directory, and closes the filepointer again. You should be able to get the rest by yourself. Go read the manual too.
www.php.net/fopen
www.php.net/fread
www.php.net/fwrite
www.php.net/fclose