fandelem,
Check out the fopen and associated calls.
fopen will accept a URL as an argument.
All you need to do is open 2 file streams:
One to the server for reading and one to a local file for writing, and then just fread and fwrite to each.
Hope this helps!
Regards,
Mark.