You may already be familiar with file_get_contents() for reading the contents of a local file but did you know that you can use it to read the contents of a remote file or site? You can then use file_put_contents() to write the file’s contents back to disk:

file_put_contents('./some/local/file', file_get_contents(''));

Both functions are binary safe so you should be fine to work with files that are not simply full of ASCII text.