Hi there,
When working with files (local or remote) then you should use the Filesystem Functions, such as fopen(), fread() or file_get_contents(). The easiest way to retrieve the content of a file is to use file_get_contents() which is available to you since PHP 4.3.0. When you want to fetch a remote file, allow_url_fopen must be set to 1 (On) in "php.ini". If it's not, I think that you can use [man]fsockopen/man but I'm not 100% sure.
Well, how do you do to fetch a remote file and save it on your server? First; you need the URI to the file which I assume is "http://www.site.com/image.gif". Let us put this address in a variable!
$uri = 'http://www.site.com/image.gif';
The next step is to use [man]file_get_contents/man to get the binary data of the file.
$uri = 'http://www.site.com/image.gif';
$contents = file_get_contents($uri);
Now we have the image stored in a variable called $contents. Now it's time for us to decide what the file on your server should be named. Let's put this in a variable:
$filename = 'copied_image.gif';
If you want the name to be the same as the image you copied, you can use the [man]basename/man function to extract the filename from the URI:
$filename = basename($uri);
Now we have all the data we need; the URI, the data and the filename. Now we will use [man]fopen/man and [man]fwrite/man to create the file on your server.
// copy the remote file
$uri = 'http://www.site.com/image.gif';
$contents = file_get_contents($uri);
$filename = basename($uri);
// create the local file
$fp = fopen($filename, 'w');
fwrite($fp, $contents);
fclose($fp);
Now there should be a file on your server called "image.gif" and it should be a copy of the remote file that you wanted. If you want to delete it from the server, then use the [man]unlink/man function.
If there is something you don't understand or if you have more questions, then just ask them here and we'll try to answer it as good as we can.
-- lilleman