I don't see why you should need to do anything with headers.
$file = fopen("remotefile.ext", "a");
fwrite($file, $data_to_write);
fclose($file);
It's as simple as that...almost. The file you are writing to MUST either be owned by the user on the server that PHP is given ownership permissions to (on *nix, usually HTTPD), or must be CHMOD'd to 607 or higher (although I would advise to use the first solution).